ignition_file

Describes a file to be written in a particular filesystem.

Example Usage

File with inline content:

data "ignition_file" "hello" {
    filesystem = "foo"
    path = "/hello.txt"
    content {
        content = "Hello World!"
    }
}

File with remote content:

data "ignition_file" "hello" {
    filesystem = "qux"
    path = "/hello.txt"
    source {
        source = "http://example.com/hello.txt.gz"
        compression = "gzip"
        verification = "sha512-0123456789abcdef0123456789...456789abcdef"
    }
}

Argument Reference

The following arguments are supported:

  • filesystem - (Required) The internal identifier of the filesystem. This matches the last filesystem with the given identifier. This should be a valid name from a ignition_filesystem resource.

  • path - (Required) The absolute path to the file.

  • content - (Optional) Block to provide the file content inline.

  • source - (Optional) Block to retrieve the file content from a remote location.

    Note: content and source are mutually exclusive.

  • mode - (Optional) The file's permission mode. The mode must be properly specified as a decimal value (i.e. 0644 -> 420).

  • uid - (Optional) The user ID of the owner.

  • gid - (Optional) The group ID of the owner.

The content block supports:

  • mime - (Required) MIME format of the content (default text/plain).

  • content - (Required) Content of the file.

The source block supports:

  • source - (Required) The URL of the file contents. Supported schemes are http, https, tftp, s3, and data. When using http, it is advisable to use the verification option to ensure the contents haven't been modified.

  • compression - (Optional) The type of compression used on the contents (null or gzip). Compression cannot be used with S3.

  • verification - (Optional) The hash of the config, in the form <type>-<value> where type is sha512.

Attributes Reference

The following attributes are exported:

  • id - ID used to reference this resource in ignition_config.

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/ignition/d/file.html