From 5aa38ef0f8173f982890adfed307cc65d3e01379 Mon Sep 17 00:00:00 2001 From: Jake Heath Date: Thu, 18 May 2023 12:09:51 -0700 Subject: [PATCH 1/4] fix: wrong relative path in terragrunt files --- .../component/terraform/terragrunt.hcl.tmpl | 13 ++++-- .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../circleci/terraform/global/terragrunt.hcl | 1 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/acct1/terragrunt.hcl | 3 +- .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/account/terragrunt.hcl | 3 +- .../envs/staging/comp1/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../tfe_config/terraform/tfe/terragrunt.hcl | 1 + .../terraform/accounts/foo/terragrunt.hcl | 3 +- .../terraform/envs/bar/bam/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + testdata/v2_full_yaml/fogg.yml | 10 ++++- .../terraform/accounts/bar/fogg.tf | 14 ------- .../terraform/accounts/bar/terragrunt.hcl | 4 +- .../terraform/accounts/foo/terragrunt.hcl | 1 + .../envs/prod/datadog/terragrunt.hcl | 2 + .../terraform/envs/prod/hero/terragrunt.hcl | 1 + .../terraform/envs/prod/okta/terragrunt.hcl | 2 + .../terraform/envs/prod/sentry/fogg.tf | 42 +++++++++++++++++++ .../terraform/envs/prod/sentry/terragrunt.hcl | 4 ++ .../terraform/envs/prod/vpc/terragrunt.hcl | 2 + .../envs/staging/comp1/terragrunt.hcl | 2 + .../envs/staging/comp2/terragrunt.hcl | 2 + .../terraform/envs/staging/vpc/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/global/terragrunt.hcl | 1 + .../terraform/accounts/bar/terragrunt.hcl | 5 ++- .../terraform/accounts/foo/terragrunt.hcl | 5 ++- .../envs/staging/comp1/terragrunt.hcl | 2 + .../envs/staging/comp2/terragrunt.hcl | 2 + .../terraform/envs/staging/vpc/terragrunt.hcl | 2 + .../terraform/global/terragrunt.hcl | 1 + 48 files changed, 136 insertions(+), 33 deletions(-) diff --git a/templates/templates/component/terraform/terragrunt.hcl.tmpl b/templates/templates/component/terraform/terragrunt.hcl.tmpl index 04d4a70fe..aeb3d9f6e 100644 --- a/templates/templates/component/terraform/terragrunt.hcl.tmpl +++ b/templates/templates/component/terraform/terragrunt.hcl.tmpl @@ -2,10 +2,17 @@ dependencies { paths = [ -{{ range $component, $backend := .ComponentBackends -}} -{{ if ne $component $outer.Name}} "../{{$component}}", +{{ if avail "Env" . -}} + {{ if eq .Env "accounts" -}} + {{ range $name, $backend := .AccountBackends }} "../{{$name}}", {{ end -}} +{{- else if eq .Env "" -}} +{{- else -}} +{{- range $component, $backend := .ComponentBackends }} "../{{$component}}", {{ end -}} {{ range $name, $backend := .AccountBackends}} "../../../accounts/{{$name}}", -{{ end }} ] +{{ end -}} +{{- end -}} +{{- end }} + ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/circleci/terraform/global/terragrunt.hcl b/testdata/circleci/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/circleci/terraform/global/terragrunt.hcl +++ b/testdata/circleci/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/github_actions/terraform/global/terragrunt.hcl b/testdata/github_actions/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/github_actions/terraform/global/terragrunt.hcl +++ b/testdata/github_actions/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl index 004eabada..dbd169942 100644 --- a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/acct1", + "../acct1", + ] } \ No newline at end of file diff --git a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl index c449cc53f..9dcf5a900 100644 --- a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl +++ b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/account", + "../account", + ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl index c449cc53f..4ac636d36 100644 --- a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../comp1", "../../../accounts/account", + ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/global/terragrunt.hcl b/testdata/tfe_config/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/tfe_config/terraform/global/terragrunt.hcl +++ b/testdata/tfe_config/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/tfe/terragrunt.hcl b/testdata/tfe_config/terraform/tfe/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/tfe_config/terraform/tfe/terragrunt.hcl +++ b/testdata/tfe_config/terraform/tfe/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0d6c91ad3..f2f25ec21 100644 --- a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,7 @@ dependencies { paths = [ - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 0d6c91ad3..de681141f 100644 --- a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -2,6 +2,8 @@ dependencies { paths = [ + "../bam", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/fogg.yml b/testdata/v2_full_yaml/fogg.yml index 668f11895..316e7dc19 100644 --- a/testdata/v2_full_yaml/fogg.yml +++ b/testdata/v2_full_yaml/fogg.yml @@ -1,5 +1,9 @@ accounts: bar: + depends_on: + accounts: + - foo + components: [] providers: aws: account_id: 00456 @@ -79,9 +83,11 @@ envs: sentry: version: 1.2.3 depends_on: - accounts: [] - components: + accounts: - foo + - bar + components: + - okta - hero okta: providers: diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf index 8935a4300..130e8068a 100644 --- a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf +++ b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf @@ -290,20 +290,6 @@ data "terraform_remote_state" "global" { profile = "profile" - } -} -data "terraform_remote_state" "bar" { - backend = "s3" - config = { - - - bucket = "buck" - - key = "terraform/proj/accounts/bar.tfstate" - region = "us-west-2" - profile = "profile" - - } } data "terraform_remote_state" "foo" { diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl index 0f9f37e1e..f2f25ec21 100644 --- a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl @@ -2,7 +2,7 @@ dependencies { paths = [ - "../../../accounts/bar", - "../../../accounts/foo", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl index 1689fe971..f1a73ce82 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl @@ -2,11 +2,13 @@ dependencies { paths = [ + "../datadog", "../hero", "../okta", "../sentry", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl index 3f95e62ae..f1a73ce82 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl @@ -4,9 +4,11 @@ dependencies { paths = [ "../datadog", "../hero", + "../okta", "../sentry", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/sentry/fogg.tf b/testdata/v2_full_yaml/terraform/envs/prod/sentry/fogg.tf index 149b5bfc7..cdcf17fb8 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/sentry/fogg.tf +++ b/testdata/v2_full_yaml/terraform/envs/prod/sentry/fogg.tf @@ -168,6 +168,48 @@ data "terraform_remote_state" "hero" { profile = "profile" + } +} +data "terraform_remote_state" "okta" { + backend = "s3" + config = { + + + bucket = "buck" + + key = "terraform/proj/envs/prod/components/okta.tfstate" + region = "us-west-2" + profile = "profile" + + + } +} +data "terraform_remote_state" "bar" { + backend = "s3" + config = { + + + bucket = "buck" + + key = "terraform/proj/accounts/bar.tfstate" + region = "us-west-2" + profile = "profile" + + + } +} +data "terraform_remote_state" "foo" { + backend = "s3" + config = { + + + bucket = "buck" + + key = "terraform/proj/accounts/foo.tfstate" + region = "us-west-2" + profile = "profile" + + } } # tflint-ignore: terraform_unused_declarations diff --git a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl index 47162c1a3..77415ec1e 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl @@ -3,5 +3,9 @@ dependencies { paths = [ "../hero", + "../okta", + "../../../accounts/bar", + "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl index 0d618cc35..f1a73ce82 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl @@ -6,7 +6,9 @@ dependencies { "../hero", "../okta", "../sentry", + "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl index a5e6bea2e..de25a79dc 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -2,9 +2,11 @@ dependencies { paths = [ + "../comp1", "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl index 2f90d4c34..de25a79dc 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -3,8 +3,10 @@ dependencies { paths = [ "../comp1", + "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl index a98116bfc..de25a79dc 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -4,7 +4,9 @@ dependencies { paths = [ "../comp1", "../comp2", + "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl index 0f9f37e1e..9c2ffe2bc 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl @@ -2,7 +2,8 @@ dependencies { paths = [ - "../../../accounts/bar", - "../../../accounts/foo", + "../bar", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 0f9f37e1e..9c2ffe2bc 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,7 +2,8 @@ dependencies { paths = [ - "../../../accounts/bar", - "../../../accounts/foo", + "../bar", + "../foo", + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl index a5e6bea2e..de25a79dc 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -2,9 +2,11 @@ dependencies { paths = [ + "../comp1", "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl index 2f90d4c34..de25a79dc 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -3,8 +3,10 @@ dependencies { paths = [ "../comp1", + "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl index a98116bfc..de25a79dc 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -4,7 +4,9 @@ dependencies { paths = [ "../comp1", "../comp2", + "../vpc", "../../../accounts/bar", "../../../accounts/foo", + ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl index 9a00856ae..9a13ca824 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl @@ -2,5 +2,6 @@ dependencies { paths = [ + ] } \ No newline at end of file From 1259f8b60b05946d84099fee86dda5ac3a65999d Mon Sep 17 00:00:00 2001 From: Jake Heath Date: Thu, 18 May 2023 12:21:08 -0700 Subject: [PATCH 2/4] don't reference self --- .../templates/component/terraform/terragrunt.hcl.tmpl | 10 ++++++---- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../terraform/global/terragrunt.hcl | 2 -- testdata/circleci/terraform/global/terragrunt.hcl | 2 -- .../github_actions/terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../okta_provider_yaml/terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/acct1/terragrunt.hcl | 2 -- .../terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/account/terragrunt.hcl | 2 -- .../terraform/envs/staging/comp1/terragrunt.hcl | 3 --- testdata/tfe_config/terraform/global/terragrunt.hcl | 2 -- testdata/tfe_config/terraform/tfe/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/bar/bam/terragrunt.hcl | 3 --- .../tfe_provider_yaml/terraform/global/terragrunt.hcl | 2 -- .../v2_full_yaml/terraform/accounts/bar/terragrunt.hcl | 2 -- .../v2_full_yaml/terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/prod/datadog/terragrunt.hcl | 3 --- .../terraform/envs/prod/hero/terragrunt.hcl | 2 -- .../terraform/envs/prod/okta/terragrunt.hcl | 3 --- .../terraform/envs/prod/sentry/terragrunt.hcl | 2 -- .../terraform/envs/prod/vpc/terragrunt.hcl | 3 --- .../terraform/envs/staging/comp1/terragrunt.hcl | 3 --- .../terraform/envs/staging/comp2/terragrunt.hcl | 3 --- .../terraform/envs/staging/vpc/terragrunt.hcl | 3 --- testdata/v2_full_yaml/terraform/global/terragrunt.hcl | 2 -- .../terraform/global/terragrunt.hcl | 2 -- .../terraform/accounts/bar/terragrunt.hcl | 2 -- .../terraform/accounts/foo/terragrunt.hcl | 2 -- .../terraform/envs/staging/comp1/terragrunt.hcl | 3 --- .../terraform/envs/staging/comp2/terragrunt.hcl | 3 --- .../terraform/envs/staging/vpc/terragrunt.hcl | 3 --- .../terraform/global/terragrunt.hcl | 2 -- 45 files changed, 6 insertions(+), 108 deletions(-) diff --git a/templates/templates/component/terraform/terragrunt.hcl.tmpl b/templates/templates/component/terraform/terragrunt.hcl.tmpl index aeb3d9f6e..07894ba44 100644 --- a/templates/templates/component/terraform/terragrunt.hcl.tmpl +++ b/templates/templates/component/terraform/terragrunt.hcl.tmpl @@ -1,4 +1,4 @@ -{{ $outer := . }} +{{ $outer := . -}} dependencies { paths = [ @@ -8,9 +8,11 @@ dependencies { {{ end -}} {{- else if eq .Env "" -}} {{- else -}} -{{- range $component, $backend := .ComponentBackends }} "../{{$component}}", -{{ end -}} -{{ range $name, $backend := .AccountBackends}} "../../../accounts/{{$name}}", +{{- range $component, $backend := .ComponentBackends -}} + {{- if ne $component $outer.Name }} "../{{$component}}", +{{ end -}} +{{- end -}} +{{- range $name, $backend := .AccountBackends}} "../../../accounts/{{$name}}", {{ end -}} {{- end -}} {{- end }} diff --git a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/circleci/terraform/global/terragrunt.hcl b/testdata/circleci/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/circleci/terraform/global/terragrunt.hcl +++ b/testdata/circleci/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/github_actions/terraform/global/terragrunt.hcl b/testdata/github_actions/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/github_actions/terraform/global/terragrunt.hcl +++ b/testdata/github_actions/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl index dbd169942..3412d9848 100644 --- a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../acct1", diff --git a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl index 9dcf5a900..78c938b04 100644 --- a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl +++ b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../account", diff --git a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl index 4ac636d36..e3ebe4cf0 100644 --- a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../comp1", "../../../accounts/account", ] diff --git a/testdata/tfe_config/terraform/global/terragrunt.hcl b/testdata/tfe_config/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/tfe_config/terraform/global/terragrunt.hcl +++ b/testdata/tfe_config/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/tfe_config/terraform/tfe/terragrunt.hcl b/testdata/tfe_config/terraform/tfe/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/tfe_config/terraform/tfe/terragrunt.hcl +++ b/testdata/tfe_config/terraform/tfe/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index de681141f..83f5c7c10 100644 --- a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../bam", "../../../accounts/foo", ] diff --git a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl index f2f25ec21..1961d83dd 100644 --- a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../foo", diff --git a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl index f1a73ce82..0021c65d8 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../datadog", "../hero", "../okta", "../sentry", diff --git a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl index f1a73ce82..d721131ba 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl @@ -1,10 +1,7 @@ - - dependencies { paths = [ "../datadog", "../hero", - "../okta", "../sentry", "../vpc", "../../../accounts/bar", diff --git a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl index 77415ec1e..63b0fc387 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../hero", diff --git a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl index f1a73ce82..fa07b8b0c 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl @@ -1,12 +1,9 @@ - - dependencies { paths = [ "../datadog", "../hero", "../okta", "../sentry", - "../vpc", "../../../accounts/bar", "../../../accounts/foo", diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl index de25a79dc..88b8cf94d 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../comp1", "../comp2", "../vpc", "../../../accounts/bar", diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl index de25a79dc..95153d885 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -1,9 +1,6 @@ - - dependencies { paths = [ "../comp1", - "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", diff --git a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl index de25a79dc..87048d0b7 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -1,10 +1,7 @@ - - dependencies { paths = [ "../comp1", "../comp2", - "../vpc", "../../../accounts/bar", "../../../accounts/foo", diff --git a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl index 9c2ffe2bc..bdd2b0c2b 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../bar", diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 9c2ffe2bc..bdd2b0c2b 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ "../bar", diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl index de25a79dc..88b8cf94d 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -1,8 +1,5 @@ - - dependencies { paths = [ - "../comp1", "../comp2", "../vpc", "../../../accounts/bar", diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl index de25a79dc..95153d885 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -1,9 +1,6 @@ - - dependencies { paths = [ "../comp1", - "../comp2", "../vpc", "../../../accounts/bar", "../../../accounts/foo", diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl index de25a79dc..87048d0b7 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -1,10 +1,7 @@ - - dependencies { paths = [ "../comp1", "../comp2", - "../vpc", "../../../accounts/bar", "../../../accounts/foo", diff --git a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl index 9a13ca824..bb8c3e0ac 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,3 @@ - - dependencies { paths = [ From 0f4b286d27986a3867ebdfca409f6781d5f9741f Mon Sep 17 00:00:00 2001 From: Jake Heath Date: Thu, 18 May 2023 12:22:37 -0700 Subject: [PATCH 3/4] trailing newline --- templates/templates/component/terraform/terragrunt.hcl.tmpl | 3 +-- .../auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl | 1 - testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl | 1 - .../bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl | 1 - testdata/bless_provider_yaml/terraform/global/terragrunt.hcl | 1 - testdata/circleci/terraform/global/terragrunt.hcl | 1 - testdata/github_actions/terraform/global/terragrunt.hcl | 1 - .../github_provider_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl | 1 - testdata/github_provider_yaml/terraform/global/terragrunt.hcl | 1 - .../okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl | 1 - testdata/okta_provider_yaml/terraform/global/terragrunt.hcl | 1 - .../terraform/accounts/acct1/terragrunt.hcl | 1 - testdata/remote_backend_yaml/terraform/global/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/envs/bar/bam/terragrunt.hcl | 1 - .../snowflake_provider_yaml/terraform/global/terragrunt.hcl | 1 - testdata/tfe_config/terraform/accounts/account/terragrunt.hcl | 1 - .../tfe_config/terraform/envs/staging/comp1/terragrunt.hcl | 1 - testdata/tfe_config/terraform/global/terragrunt.hcl | 1 - testdata/tfe_config/terraform/tfe/terragrunt.hcl | 1 - .../tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl | 1 - testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl | 1 - .../v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl | 1 - .../v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl | 1 - .../v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl | 1 - .../v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl | 1 - .../v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl | 1 - testdata/v2_full_yaml/terraform/global/terragrunt.hcl | 1 - testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl | 1 - .../terraform/accounts/bar/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/envs/staging/comp1/terragrunt.hcl | 1 - .../terraform/envs/staging/comp2/terragrunt.hcl | 1 - .../terraform/envs/staging/vpc/terragrunt.hcl | 1 - .../v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl | 1 - 45 files changed, 1 insertion(+), 46 deletions(-) diff --git a/templates/templates/component/terraform/terragrunt.hcl.tmpl b/templates/templates/component/terraform/terragrunt.hcl.tmpl index 07894ba44..ca6d8e103 100644 --- a/templates/templates/component/terraform/terragrunt.hcl.tmpl +++ b/templates/templates/component/terraform/terragrunt.hcl.tmpl @@ -15,6 +15,5 @@ dependencies { {{- range $name, $backend := .AccountBackends}} "../../../accounts/{{$name}}", {{ end -}} {{- end -}} -{{- end }} - ] +{{- end }} ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/circleci/terraform/global/terragrunt.hcl b/testdata/circleci/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/circleci/terraform/global/terragrunt.hcl +++ b/testdata/circleci/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/github_actions/terraform/global/terragrunt.hcl b/testdata/github_actions/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/github_actions/terraform/global/terragrunt.hcl +++ b/testdata/github_actions/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/github_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl index 3412d9848..9d22f05e8 100644 --- a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../acct1", - ] } \ No newline at end of file diff --git a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl index 78c938b04..3b4a552ff 100644 --- a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl +++ b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../account", - ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl index e3ebe4cf0..05702bb97 100644 --- a/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/tfe_config/terraform/envs/staging/comp1/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/account", - ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/global/terragrunt.hcl b/testdata/tfe_config/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/tfe_config/terraform/global/terragrunt.hcl +++ b/testdata/tfe_config/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/tfe/terragrunt.hcl b/testdata/tfe_config/terraform/tfe/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/tfe_config/terraform/tfe/terragrunt.hcl +++ b/testdata/tfe_config/terraform/tfe/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl index 83f5c7c10..c121afc3e 100644 --- a/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/envs/bar/bam/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl index 1961d83dd..5af6345d1 100644 --- a/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/bar/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl index 0021c65d8..c59611245 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/datadog/terragrunt.hcl @@ -6,6 +6,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/hero/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl index d721131ba..57123aa44 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/okta/terragrunt.hcl @@ -6,6 +6,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl index 63b0fc387..9d10243cf 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/sentry/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../okta", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl index fa07b8b0c..2340ac347 100644 --- a/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/prod/vpc/terragrunt.hcl @@ -6,6 +6,5 @@ dependencies { "../sentry", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl index 88b8cf94d..0f9b6c696 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl index 95153d885..c81d46bf6 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl index 87048d0b7..34d2fa2a2 100644 --- a/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../comp2", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/v2_full_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_full_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_minimal_valid_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl index bdd2b0c2b..3d463e00d 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl @@ -2,6 +2,5 @@ dependencies { paths = [ "../bar", "../foo", - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl index bdd2b0c2b..3d463e00d 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -2,6 +2,5 @@ dependencies { paths = [ "../bar", "../foo", - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl index 88b8cf94d..0f9b6c696 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp1/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl index 95153d885..c81d46bf6 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/comp2/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../vpc", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl index 87048d0b7..34d2fa2a2 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/envs/staging/vpc/terragrunt.hcl @@ -4,6 +4,5 @@ dependencies { "../comp2", "../../../accounts/bar", "../../../accounts/foo", - ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl index bb8c3e0ac..3af9d8af7 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/global/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - ] } \ No newline at end of file From 425dc0e8a71a563587c71c33ffca4463eec7ae8e Mon Sep 17 00:00:00 2001 From: Jake Heath Date: Thu, 18 May 2023 12:24:46 -0700 Subject: [PATCH 4/4] don't let reference self --- .../component/terraform/terragrunt.hcl.tmpl | 4 +++- .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/accounts/acct1/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - .../terraform/accounts/account/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - testdata/v2_full_yaml/fogg.yml | 1 + .../v2_full_yaml/terraform/accounts/bar/fogg.tf | 14 ++++++++++++++ .../terraform/accounts/bar/terragrunt.hcl | 1 - .../terraform/accounts/foo/terragrunt.hcl | 1 - 13 files changed, 18 insertions(+), 11 deletions(-) diff --git a/templates/templates/component/terraform/terragrunt.hcl.tmpl b/templates/templates/component/terraform/terragrunt.hcl.tmpl index ca6d8e103..8d22b3410 100644 --- a/templates/templates/component/terraform/terragrunt.hcl.tmpl +++ b/templates/templates/component/terraform/terragrunt.hcl.tmpl @@ -4,8 +4,10 @@ dependencies { paths = [ {{ if avail "Env" . -}} {{ if eq .Env "accounts" -}} - {{ range $name, $backend := .AccountBackends }} "../{{$name}}", + {{ range $name, $backend := .AccountBackends -}} + {{- if ne $name $outer.Name }} "../{{$name}}", {{ end -}} +{{- end -}} {{- else if eq .Env "" -}} {{- else -}} {{- range $component, $backend := .ComponentBackends -}} diff --git a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/auth0_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/bless_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/github_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/okta_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl index 9d22f05e8..3af9d8af7 100644 --- a/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl +++ b/testdata/remote_backend_yaml/terraform/accounts/acct1/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../acct1", ] } \ No newline at end of file diff --git a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/snowflake_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl index 3b4a552ff..3af9d8af7 100644 --- a/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl +++ b/testdata/tfe_config/terraform/accounts/account/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../account", ] } \ No newline at end of file diff --git a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 5af6345d1..3af9d8af7 100644 --- a/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/tfe_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,5 +1,4 @@ dependencies { paths = [ - "../foo", ] } \ No newline at end of file diff --git a/testdata/v2_full_yaml/fogg.yml b/testdata/v2_full_yaml/fogg.yml index 316e7dc19..13ef28fb8 100644 --- a/testdata/v2_full_yaml/fogg.yml +++ b/testdata/v2_full_yaml/fogg.yml @@ -3,6 +3,7 @@ accounts: depends_on: accounts: - foo + - bar components: [] providers: aws: diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf index 130e8068a..8935a4300 100644 --- a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf +++ b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf @@ -290,6 +290,20 @@ data "terraform_remote_state" "global" { profile = "profile" + } +} +data "terraform_remote_state" "bar" { + backend = "s3" + config = { + + + bucket = "buck" + + key = "terraform/proj/accounts/bar.tfstate" + region = "us-west-2" + profile = "profile" + + } } data "terraform_remote_state" "foo" { diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl index 3d463e00d..5af6345d1 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/bar/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ - "../bar", "../foo", ] } \ No newline at end of file diff --git a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl index 3d463e00d..43cac0d2f 100644 --- a/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl +++ b/testdata/v2_no_aws_provider_yaml/terraform/accounts/foo/terragrunt.hcl @@ -1,6 +1,5 @@ dependencies { paths = [ "../bar", - "../foo", ] } \ No newline at end of file