-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should Terragrunt 0.19 convert var files into env vars ? #737
Comments
Yea, the change in Terraform 0.12 to be more strict about what can be passed via Having Terragrunt convert Another option is to add a new # stage/frontend-app/terragrunt.hcl
inputs = {
aws_region = get_input("../../common.hcl", "aws_region")
remote_state_bucket = get_input("../../common.hcl", "remote_state_bucket")
instance_type = "t2.micro"
instance_count = 10
} And inputs = {
aws_region = "us-east-1"
remote_state_bucket = "my-staging-bucket"
} This approach matches the Terraform philosophy of "explicit over implicit," but the downside is that it's verbose and repetitive. On a side note, the inputs = {
# Read an output from the VPC module
vpc_id = get_output("../vpc", "vpc_id")
} Again, this is explicit over implicit, giving you a clear, visible definition of dependencies between modules. Other ideas are welcome! |
If I am not mistaken, this has also made it difficult to have a variable in the global.tfvars file and then override it in a child terragrunt.hcl file. e.g. have a default instance_type variable of "t2.micro" then change that on a case by case basis to something else further on down the chain. |
I've created the pull request to allow undeclared variables from Personally, I don't see any reason why it was introduced apart from giving feedback to users who make typos: https://github.com/hashicorp/terraform/blob/master/backend/unparsed_value.go#L61 |
The PR was rejected despite the warnings were clearly not supported by the community: hashicorp/terraform#19424 So I'm not sure what to do with it. |
closing in favor of #752 |
Well, I think this issue is about something different: warnings generated for undeclared variables set globally in |
@ekini I think this issue is about making decision to be implicit or to follow Terraform by defining explicitly variables. For me, both #737 and #752 are defining how to handle inputs. But if you want, I can reopen this issue and rename its title into something like : How Terragrunt should handle inputs ? |
Now in Terraform 0.12, every variable should be declared. So when you use a common variables (like
global.tfvars
) which are always loaded by Terragrunt, you get a warning in Terraform 0.12 and you'll get an error in Terraform 0.13.How do we handle this ? Is Terragrunt should load those files as env vars prefixed with
TF_VAR_
? Should we add another attribute for env vars file ? Something like :The text was updated successfully, but these errors were encountered: