-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
allow input validation with variable in source or version #5041
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
Changes from all commits
9d7f9b1
f1c46c1
6017839
30b97f4
0a411af
bce296b
3a439ea
4f66e86
e9a8894
fa7d98c
d626340
26a0a14
93e08d9
82301a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| repos: | ||
| - repo: https://github.com/gruntwork-io/pre-commit | ||
| rev: v0.1.29 | ||
| rev: v0.1.29 | ||
| hooks: | ||
| - id: tofu-fmt | ||
| exclude: test/fixtures/hclvalidate/valid/.* | ||
| - id: goimports |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| locals { | ||
| first = local.second | ||
| second = local.first | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| // intentionally blank |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # This terraform code is intentionally invalid | ||
| output "out" { | ||
| value = local.nonexistent | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| // intentionally blank |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| variable "input" { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| inputs = { | ||
| input = "value" | ||
| } |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to make an even more minimal example than the one in #4986
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love the names on these fixtures. Reading the name of the fixture should tell you what the fixture is for. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| locals { | ||
| variable_source = "github.com/foo/bar" | ||
| } | ||
|
|
||
| module "module" { | ||
| source = local.variable_source | ||
| version = "0.0.0" | ||
| } |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know empty files seem silly, but in the spirit of "minimal reproduction" I don't think you can get more minimal than empty!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing wrong with it! If you want to be explicit about this, you can leave a one-line comment in the file that it's intentionally empty. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| // intentionally blank |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| locals { | ||
| variable_version = "0.0.0" | ||
| } | ||
|
|
||
| module "module" { | ||
| source = "github.com/foo/bar" | ||
| version = local.variable_version | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| // intentionally blank |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to input on this, or even removing it. But I definitely don't think the current wording is correct (since we're checking that the unit sets variables consumed by the module, the module doesn't set them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would better wording be: "When enabled, Terragrunt will validate that all inputs set by Terragrunt units are valid OpenTofu/Terraform variables consumed by their respective modules"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that only is accurate when using
--strict, without--strictyou can set inputs that are not consumed / don't exist as variables