-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
bug: discovery parsing errors handling #5037
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a3a5faf
fix: improved handling for deprecated configurations
denis256 ccd74d2
chore: discovery errors parsing simplifications
denis256 647ca26
parsing errors simplification
denis256 f373495
chore: simplified error logs
denis256 d37d3ce
add tf file
denis256 fcec3bc
strict error update
denis256 6cd5407
fix: failing tests fixes
denis256 b6c6911
chore: goimports update
denis256 cdc4e56
chore: discovery cleanup
denis256 3833956
Merge branch 'main' into 4983-parse-error
denis256 8ac1189
double star constant
denis256 8fb07b5
Merge remote-tracking branch 'origin/main' into 4983-parse-error
denis256 b99b08a
Merge remote-tracking branch 'origin/4983-parse-error' into 4983-pars…
denis256 8d0b226
feat: usage of exernal dependencies from discovery
denis256 b81dd35
bug: fixed popoulation of dependencies
denis256 47d8df8
chore: naming convention simplification
denis256 7df7c88
naming conventions update
denis256 87cdc45
chore: unit resolver fixer
denis256 0f63a22
chore: simplifed todos
denis256 35aee69
Merge remote-tracking branch 'origin/main' into 4983-parse-error
denis256 a387ccb
unit runner updates
denis256 9f73d93
fix: failing filtering test
denis256 71ab432
Merge branch 'main' into 4983-parse-error
denis256 bd601a0
Merge branch 'main' into 4983-parse-error
denis256 3216b71
chore: path normalization fixes
denis256 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/fixtures/parsing/exposed-include-with-deprecated-inputs/child/terragrunt.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Child configuration that includes compcommon with expose = true | ||
| # This should trigger the bug where the deprecated syntax in compcommon isn't detected | ||
|
|
||
| include "root" { | ||
| path = find_in_parent_folders("root.hcl") | ||
| expose = true | ||
| } | ||
|
|
||
| include "compcommon" { | ||
| path = find_in_parent_folders("compcommon.hcl") | ||
| expose = true | ||
| } | ||
|
|
||
| terraform { | ||
| source = "git::[email protected]:gruntwork-io/terragrunt.git//test/fixtures/download/hello-world" | ||
| } | ||
|
|
||
| dependency "service" { | ||
| config_path = "../dep" | ||
| mock_outputs_allowed_terraform_commands = ["validate", "plan"] | ||
| mock_outputs = { | ||
| some_value = "mock-service-value" | ||
| } | ||
| mock_outputs_merge_strategy_with_state = "shallow" | ||
| } | ||
|
|
||
| # Reference the exposed include - this will try to evaluate compcommon | ||
| # which contains the deprecated syntax | ||
| inputs = { | ||
| from_common = try(include.compcommon.inputs.value_from_dep, "fallback") | ||
| from_service = dependency.service.outputs.some_value | ||
| } |
16 changes: 16 additions & 0 deletions
16
test/fixtures/parsing/exposed-include-with-deprecated-inputs/compcommon.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Common configuration that uses deprecated dependency.*.inputs.* syntax | ||
| # This should trigger the bug when included with expose = true | ||
|
|
||
| dependency "dep" { | ||
| config_path = "../dep" | ||
| mock_outputs_allowed_terraform_commands = ["validate", "plan"] | ||
| mock_outputs = { | ||
| some_value = "mock-value" | ||
| } | ||
| mock_outputs_merge_strategy_with_state = "shallow" | ||
| } | ||
|
|
||
| # Using deprecated syntax - this should be caught but isn't in partial parse | ||
| inputs = { | ||
| value_from_dep = dependency.dep.inputs.some_value | ||
| } |
8 changes: 8 additions & 0 deletions
8
test/fixtures/parsing/exposed-include-with-deprecated-inputs/dep/terragrunt.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Mock dependency configuration | ||
| terraform { | ||
| source = "git::[email protected]:gruntwork-io/terragrunt.git//test/fixtures/download/hello-world" | ||
| } | ||
|
|
||
| inputs = { | ||
| some_value = "test-value" | ||
| } |
4 changes: 4 additions & 0 deletions
4
test/fixtures/parsing/exposed-include-with-deprecated-inputs/root.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Minimal root configuration | ||
| locals { | ||
| region = "us-east-1" | ||
| } |
29 changes: 29 additions & 0 deletions
29
test/fixtures/regressions/parsing-run-all-with-generate/root.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| locals { | ||
| aws_provider_version = "6.15.0" | ||
| } | ||
|
|
||
| # Generate an AWS provider block | ||
| generate "provider" { | ||
| path = "provider.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| contents = <<EOF | ||
| provider "aws" { | ||
| region = "us-east-1" | ||
| } | ||
| EOF | ||
| } | ||
|
|
||
| generate "versions_override" { | ||
| path = "versions_override.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| contents = <<EOF | ||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "${local.aws_provider_version}" | ||
| } | ||
| } | ||
| } | ||
| EOF | ||
| } |
26 changes: 26 additions & 0 deletions
26
test/fixtures/regressions/parsing-run-all-with-generate/services-info/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| variable "desired_count" { | ||
| description = "The desired count of the ECS Service" | ||
| type = map(number) | ||
| } | ||
|
|
||
| variable "use_api_image" { | ||
| description = "Whether to use the API image" | ||
| type = map(bool) | ||
| } | ||
|
|
||
| resource "null_resource" "services_info" { | ||
| triggers = { | ||
| desired_count = jsonencode(var.desired_count) | ||
| use_api_image = jsonencode(var.use_api_image) | ||
| } | ||
| } | ||
|
|
||
| output "desired_count" { | ||
| description = "The desired count of the ECS Service" | ||
| value = var.desired_count | ||
| } | ||
|
|
||
| output "use_api_image" { | ||
| description = "Whether to use the API image" | ||
| value = var.use_api_image | ||
| } |
37 changes: 37 additions & 0 deletions
37
test/fixtures/regressions/parsing-run-all-with-generate/services-info/terragrunt.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| include "root" { | ||
| path = find_in_parent_folders("root.hcl") | ||
| expose = true | ||
| } | ||
|
|
||
| terraform { | ||
| source = "${get_terragrunt_dir()}/." | ||
| } | ||
|
|
||
| dependency "service-test1" { | ||
| config_path = "../services/test1" | ||
| mock_outputs_allowed_terraform_commands = ["validate", "plan"] | ||
| mock_outputs = { | ||
| service_desired_count_initial_value = null | ||
| service_name = "FAKE-SERVICE-1" | ||
| docker_images = [ | ||
| { | ||
| repository = "123456789012.dkr.ecr.us-east-1.amazonaws.com/test1-FAKE" | ||
| } | ||
| ] | ||
| } | ||
| mock_outputs_merge_strategy_with_state = "shallow" | ||
| } | ||
|
|
||
| locals { | ||
| repository_url = "123456789012.dkr.ecr.us-east-1.amazonaws.com/api-FAKE" | ||
| name = "services-info" | ||
| } | ||
|
|
||
| inputs = { | ||
| desired_count = { | ||
| test1 = dependency.service-test1.outputs.service_desired_count_initial_value | ||
| } | ||
| use_api_image = { | ||
| test1 = dependency.service-test1.outputs.docker_images[0].repository == local.repository_url | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
test/fixtures/regressions/parsing-run-all-with-generate/services/test1/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| variable "name" { | ||
| type = string | ||
| } | ||
|
|
||
| output "service_name" { | ||
| value = var.name | ||
| } | ||
|
|
||
| output "service_desired_count_initial_value" { | ||
| value = 1 | ||
| } | ||
|
|
||
| output "docker_images" { | ||
| value = [ | ||
| { | ||
| repository = "123456789012.dkr.ecr.us-east-1.amazonaws.com/${var.name}-FAKE" | ||
| } | ||
| ] | ||
| } |
16 changes: 16 additions & 0 deletions
16
test/fixtures/regressions/parsing-run-all-with-generate/services/test1/terragrunt.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| include "root" { | ||
| path = find_in_parent_folders("root.hcl") | ||
| expose = true | ||
| } | ||
|
|
||
| terraform { | ||
| source = "${get_terragrunt_dir()}/." | ||
| } | ||
|
|
||
| locals { | ||
| name = "service1" | ||
| } | ||
|
|
||
| inputs = { | ||
| name = local.name | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is odd to me. Why don't we just nil check later?