This is a plugin for HashiCorp Terraform, which provides one with abilities to:
- Fetch remote resources by URLs
- Use variables with interpolated values
- Create local files/directories
- Download the plugin from Releases page.
- Install it, or put into a directory with configuration files.
- Create a sample configuration file
example.tf
:
data "ext_remote" "readme" {
url = "https://raw.githubusercontent.com/maxmanuylov/terraform-provider-ext/master/README.md"
}
data "ext_var" "readme_storage_path" {
value = "${path.root}/readme_storage"
}
resource "ext_local_dir" "readme_storage" {
path = "${data.ext_var.readme_storage_path.value}"
permissions = "777"
}
resource "ext_local_file" "readme" {
path = "${ext_local_dir.readme_storage.dir}/README.md"
content = "${data.ext_remote.readme.content}"
permissions = "644"
}
- Run:
$ terraform apply
Fetches resource content from the specified URL and provides it as a computed attribute. Data source performs fetch on every refresh, while resource caches the result and refetches it only in case of URL change.
url
- remote resource URL to fetch
content
- fetched content
Manages the local directory by the specified path. All parent directories are created as well if needed.
path
- local directory path
permissions
- string with octal directory permissions (e.g. "644")
dir
- equal topath
but is set after the directory is created (so you can depend on this resource and be sure the directory already exists by the time you use it)
Saves the specified content to the local file.
path
- local file pathcontent
- content to save
permissions
- string with octal file permissions (e.g. "644")
file
- equal topath
but is set after the file is written (so you can depend on this resource and be sure the file already exists by the time you use it)
Provides simple named variable. Unlike the built-in Terraform variables these variables can have interpolations in its values.
value
- variable value
Same as above, but its value is marked as sensitive to be not displayed in logs.