local_file/
variables/local_file
Variables examples using the local_file
resource.
local_file
- simple module with a local file
module
- variables example that uses the local_file
module
destroy.sh
#!/bin/bash
../../../bin/destroy.sh aws
main.tf
# Summary: Creates a local file with some content.
# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 1.0.0"
}
# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "changeme_variables_local_file_local_file_filename" {
default = "changeme_default_filename.txt"
}
# Documentation: https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file
resource "local_file" "changeme_local_file_hello_local_variable" {
content = "Hello terraform local variable module!"
filename = var.changeme_variables_local_file_local_file_filename
}
run.sh
#!/bin/bash
../../../bin/apply.sh aws
destroy.sh
#!/bin/bash
../../../bin/destroy.sh aws
main.tf
# Summary: This example uses the `../local_file` module to give an example using modules.
# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 1.0.0"
}
# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "changeme_variables_local_file_module_myfilename" {
default = "changeme_module_default_filename.txt"
}
# Documentation: https://www.terraform.io/docs/language/modules/index.html
module "hello" {
source = "../local_file"
changeme_variables_local_file_local_file_filename = var.changeme_variables_local_file_module_myfilename
}
run.sh
#!/bin/bash
../../../bin/apply.sh aws
local_file/local_file/
destroy.sh
#!/bin/bash
../../../bin/destroy.sh aws
main.tf
# Summary: Creates a local file with some content.
# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 1.0.0"
}
# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "changeme_variables_local_file_local_file_filename" {
default = "changeme_default_filename.txt"
}
# Documentation: https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file
resource "local_file" "changeme_local_file_hello_local_variable" {
content = "Hello terraform local variable module!"
filename = var.changeme_variables_local_file_local_file_filename
}
run.sh
#!/bin/bash
../../../bin/apply.sh aws
local_file/module/
destroy.sh
#!/bin/bash
../../../bin/destroy.sh aws
main.tf
# Summary: This example uses the `../local_file` module to give an example using modules.
# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 1.0.0"
}
# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "changeme_variables_local_file_module_myfilename" {
default = "changeme_module_default_filename.txt"
}
# Documentation: https://www.terraform.io/docs/language/modules/index.html
module "hello" {
source = "../local_file"
changeme_variables_local_file_local_file_filename = var.changeme_variables_local_file_module_myfilename
}
run.sh
#!/bin/bash
../../../bin/apply.sh aws