Format .tfvars file as HashiCorp Config Language. (#3885)

* Format .tfvars file as HashiCorp Config Language.

* Add sample terraform.tfvars file to demonstrate HCL rendering.
This commit is contained in:
Josh Padnick
2018-01-12 10:27:41 -07:00
committed by Colin Seymour
parent ef3b0b6af3
commit 3260b06241
2 changed files with 59 additions and 0 deletions

View File

@@ -1692,6 +1692,7 @@ HCL:
extensions: extensions:
- ".hcl" - ".hcl"
- ".tf" - ".tf"
- ".tfvars"
ace_mode: ruby ace_mode: ruby
codemirror_mode: ruby codemirror_mode: ruby
codemirror_mime_type: text/x-ruby codemirror_mime_type: text/x-ruby

View File

@@ -0,0 +1,58 @@
# Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules,
# remote state, and locking: https://github.com/gruntwork-io/terragrunt
terragrunt = {
# Configure Terragrunt to automatically store tfstate files in an S3 bucket
remote_state {
backend = "s3"
config {
encrypt = true
bucket = "acme-main-terraform-state"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-locks"
}
}
# Configure Terragrunt to use common var files to help you keep often-repeated variables (e.g., account ID) DRY.
# Note that even though Terraform automatically pulls in terraform.tfvars, we include it explicitly at the end of the
# list to make sure its variables override anything in the common var files.
terraform {
extra_arguments "common_vars" {
commands = ["${get_terraform_commands_that_need_vars()}"]
optional_var_files = [
"${get_tfvars_dir()}/${find_in_parent_folders("account.tfvars", "skip-account-if-does-not-exist")}",
"${get_tfvars_dir()}/${find_in_parent_folders("region.tfvars", "skip-region-if-does-not-exist")}",
"${get_tfvars_dir()}/${find_in_parent_folders("env.tfvars", "skip-env-if-does-not-exist")}",
"${get_tfvars_dir()}/terraform.tfvars"
]
}
}
}
key1 = "val1"
key2 = 0
key3 = 1
key4 = true
# Sample comments
key5 = false
key6 = ["hello", "from", "gruntwork.io"]
key7 = {
key1 = "hello"
key2 = "from"
key3 = "gruntwork.io"
}
key8 = [
{
keyA = "hello"
keyB = "there"
},
{
keyA = "hello"
keyB = "there"
}
]