terraform-provider-file/docs/resources/local_directory.md

1.6 KiB

page_title subcategory description
file_local_directory Resource - file Local Directory resource.

file_local_directory (Resource)

Local Directory resource.

Example Usage

resource "file_local_directory" "basic_example" {
  path        = "path/to/new/directory"
  permissions = "0700"
}

Schema

Required

  • path (String) Directory path, required. All subdirectories will also be created. Changing this forces recreate.

Optional

  • permissions (String) The directory permissions to assign to the directory, defaults to '0700'. In order to automatically create subdirectories the owner must have execute access, ie. '0600' or less prevents the provider from creating subdirectories.

Read-Only

  • created (String) The top level directory created. eg. if 'path' = '/path/to/new/directory' and '/path/to' already exists, but the rest doesn't, then 'created' will be '/path/to/new'. This path will be recursively removed during destroy and recreate actions.
  • id (String) Identifier derived from sha256 hash of path.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# IDENTIFIER="$(echo -n "path/to/file" sha256sum | awk '{print $1}')"
terraform import file_local_directory.example "IDENTIFIER"

# after this is run you will need to refine the resource further by setting the path and created properties.