-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Design pattern to avoid Warning: Value for undeclared variable ? #873
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
Comments
See #303 (comment) and #303 (comment) for the current recommended workaround. We also have had discussions around improvements to terragrunt itself, discussed here: #744 (comment) |
I've been quickly reading those refs. I'm waiting for the globals { } I guess. Since the recommended "live" organization is a tree structure, a way to define metadata at each level with downward overloading so one can have a merged relevant result on the leaf, is clearly needed. Meanwhile I'll go for the yamldecode I guess. |
Hi @rgarrigue not sure if you found your way to solve this, but I may have something that can help you. Basically, I'm using the generate to fix the var warnings.
In the root locals {
common_inputs = yamldecode(file(find_in_parent_folders("global_vars.yaml")))
inputs = merge(local.common_inputs)
}
inputs = local.inputs
generate "empty_vars" {
path = "generated_empty_vars.tf"
if_exists = "overwrite"
contents = join("\n", [for s in keys(local.common_inputs) : "variable ${s} {}"])
} This is what I've in the var001: "value001"
var002: "value002"
var003: "value003"
var004: "value004" And this is the content of the # Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
variable var001 {}
variable var002 {}
variable var003 {}
variable var004 {} |
Hi guys
I'm setting up a new live repository for a new job after 2 years. Read Terragrunt stuff again, here's the beginning of my organization (some stuff are missing, still need to be done etc)
At the provider (AWSes fodlers) level I've a terragrunt.hcl like this
My problem is, I'm defining in environment.auto.tfvars variables like
domain
, since I'm not using all of those everywhere, Terraform gives warning (soon to be errors) about undefined variables.What should I do, ship a workaround_warning_undeclared_global_vars.tf everywhere ? Feels ugly :-/
The text was updated successfully, but these errors were encountered: