From b065f4a7cdd2f78c06897fdc0f6ae54f496459e8 Mon Sep 17 00:00:00 2001 From: David Mattia Date: Thu, 25 Mar 2021 13:15:28 -0500 Subject: [PATCH] Only sets `apply_requirements` if explicitly set in `locals` (#130) * Fix apply_requirements bug * Fix tests updated with bug * bump versions --- Makefile | 2 +- README.md | 7 ++--- cmd/config.go | 3 +- cmd/generate.go | 9 ++++-- cmd/golden/apply_overrides.yaml | 28 +++++++++++++++++++ cmd/golden/autoplan.yaml | 9 ++---- cmd/golden/basic.yaml | 3 +- cmd/golden/chained_dependency.yaml | 12 +++----- cmd/golden/chained_dependency_no_flag.yaml | 12 +++----- cmd/golden/different_workflow_names.yaml | 9 ++---- cmd/golden/extraArguments.yaml | 15 ++++------ cmd/golden/extra_dependencies.yaml | 3 +- cmd/golden/filterInfraLiveNonProd.yaml | 12 +++----- cmd/golden/filterInfraLiveProd.yaml | 6 ++-- cmd/golden/infrastructureLive.yaml | 18 ++++-------- cmd/golden/invalid_parent_module.yaml | 3 +- cmd/golden/local_terraform_module.yaml | 3 +- cmd/golden/mergeParentDependencies.yaml | 6 ++-- .../multi_accounts_vpc_route53_tgw.yaml | 9 ++---- cmd/golden/namedWorkflow.yaml | 3 +- cmd/golden/noParallel.yaml | 3 +- cmd/golden/no_terraform_blocks.yml | 18 ++++-------- cmd/golden/oldWorkflowsPreserved.yaml | 3 +- cmd/golden/parentAndChildDefinedWorkflow.yaml | 3 +- cmd/golden/parentDefinedWorkflow.yaml | 3 +- cmd/golden/skip.yaml | 3 +- cmd/golden/terraform_version.yaml | 9 ++---- cmd/golden/terragrunt_dependency.yaml | 6 ++-- cmd/golden/terragrunt_dependency_ignored.yaml | 6 ++-- cmd/golden/withAutomerge.yaml | 3 +- cmd/golden/withAutoplan.yaml | 3 +- cmd/golden/withParent.yaml | 6 ++-- cmd/golden/withProjectName.yaml | 3 +- cmd/golden/withWorkspace.yaml | 3 +- cmd/golden/withoutParent.yaml | 3 +- cmd/parse_locals.go | 1 + main.go | 2 +- .../terragrunt.hcl | 15 ++++++++++ .../terragrunt.hcl | 7 +++++ .../terragrunt.hcl | 11 ++++++++ .../terragrunt.hcl | 11 ++++++++ 41 files changed, 152 insertions(+), 142 deletions(-) create mode 100644 test_examples/apply_requirements_overrides/child_that_overrides_to_empty/terragrunt.hcl create mode 100644 test_examples/apply_requirements_overrides/standalone_module_that_does_not_specify/terragrunt.hcl create mode 100644 test_examples/apply_requirements_overrides/standalone_module_that_specifies/terragrunt.hcl create mode 100644 test_examples/apply_requirements_overrides/standalone_module_that_specifies_empty/terragrunt.hcl diff --git a/Makefile b/Makefile index 6aef9a4b..98b6ef34 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=1.3.0 +VERSION=1.3.1 PATH_BUILD=build/ FILE_COMMAND=terragrunt-atlantis-config FILE_ARCH=darwin_amd64 diff --git a/README.md b/README.md index 315f2600..73b3cebd 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Then, make sure `terragrunt-atlantis-config` is present on your Atlantis server. ```hcl variable "terragrunt_atlantis_config_version" { - default = "1.3.0" + default = "1.3.1" } build { @@ -92,8 +92,7 @@ locals { In your `atlantis.yaml` file, you will end up seeing output like: ```yaml -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - "*.hcl" @@ -169,7 +168,7 @@ You can install this tool locally to checkout what kinds of config it will gener Recommended: Install any version via go get: ```bash -cd && GO111MODULE=on go get github.com/transcend-io/terragrunt-atlantis-config@v1.3.0 && cd - +cd && GO111MODULE=on go get github.com/transcend-io/terragrunt-atlantis-config@v1.3.1 && cd - ``` This module officially supports golang versions v1.13, v1.14, and v1.15, tested on CircleCI with each build diff --git a/cmd/config.go b/cmd/config.go index 181e1098..0e6a4484 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -50,7 +50,8 @@ type AtlantisProject struct { // The terraform version to use for this project TerraformVersion string `json:"terraform_version,omitempty"` - ApplyRequirements []string `json:"apply_requirements,flow"` + // We only want to output `apply_requirements` if explicitly stated in a local value + ApplyRequirements *[]string `json:"apply_requirements,omitempty"` } // Autoplan settings for which plans affect other plans diff --git a/cmd/generate.go b/cmd/generate.go index c3fcd520..bd8ffca6 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -263,9 +263,12 @@ func createProject(sourcePath string) (*AtlantisProject, error) { workflow = locals.AtlantisWorkflow } - applyRequirements := defaultApplyRequirements - if locals.ApplyRequirements != nil && len(locals.ApplyRequirements) > 0 { - applyRequirements = locals.ApplyRequirements + applyRequirements := &defaultApplyRequirements + if len(defaultApplyRequirements) == 0 { + applyRequirements = nil + } + if locals.ApplyRequirements != nil { + applyRequirements = &locals.ApplyRequirements } resolvedAutoPlan := autoPlan diff --git a/cmd/golden/apply_overrides.yaml b/cmd/golden/apply_overrides.yaml index 9cede62f..639ad933 100644 --- a/cmd/golden/apply_overrides.yaml +++ b/cmd/golden/apply_overrides.yaml @@ -18,4 +18,32 @@ projects: - '*.hcl' - '*.tf*' dir: child_that_overrides +- apply_requirements: [] + autoplan: + enabled: false + when_modified: + - '*.hcl' + - '*.tf*' + dir: child_that_overrides_to_empty +- autoplan: + enabled: false + when_modified: + - '*.hcl' + - '*.tf*' + dir: standalone_module_that_does_not_specify +- apply_requirements: + - mergeable + autoplan: + enabled: false + when_modified: + - '*.hcl' + - '*.tf*' + dir: standalone_module_that_specifies +- apply_requirements: [] + autoplan: + enabled: false + when_modified: + - '*.hcl' + - '*.tf*' + dir: standalone_module_that_specifies_empty version: 3 diff --git a/cmd/golden/autoplan.yaml b/cmd/golden/autoplan.yaml index 5bb71b79..66a94935 100644 --- a/cmd/golden/autoplan.yaml +++ b/cmd/golden/autoplan.yaml @@ -2,22 +2,19 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: autoplan_false -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' - '*.tf*' dir: autoplan_true -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' diff --git a/cmd/golden/basic.yaml b/cmd/golden/basic.yaml index 21635056..04744ff5 100644 --- a/cmd/golden/basic.yaml +++ b/cmd/golden/basic.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/chained_dependency.yaml b/cmd/golden/chained_dependency.yaml index 324e94c9..ab3c24a9 100644 --- a/cmd/golden/chained_dependency.yaml +++ b/cmd/golden/chained_dependency.yaml @@ -2,23 +2,20 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: dependency -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' - ../dependency/terragrunt.hcl dir: depender -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -27,8 +24,7 @@ projects: - ../dependency/terragrunt.hcl - nested/terragrunt.hcl dir: depender_on_depender -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/chained_dependency_no_flag.yaml b/cmd/golden/chained_dependency_no_flag.yaml index 1ac2ab1b..67d74e1d 100644 --- a/cmd/golden/chained_dependency_no_flag.yaml +++ b/cmd/golden/chained_dependency_no_flag.yaml @@ -2,23 +2,20 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: dependency -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' - ../dependency/terragrunt.hcl dir: depender -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -26,8 +23,7 @@ projects: - ../depender/terragrunt.hcl - nested/terragrunt.hcl dir: depender_on_depender -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/different_workflow_names.yaml b/cmd/golden/different_workflow_names.yaml index eb2ea595..25441a88 100644 --- a/cmd/golden/different_workflow_names.yaml +++ b/cmd/golden/different_workflow_names.yaml @@ -2,23 +2,20 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: defaultWorkflow -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: workflowA workflow: workflowA -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/extraArguments.yaml b/cmd/golden/extraArguments.yaml index 93abe1fa..c7930338 100644 --- a/cmd/golden/extraArguments.yaml +++ b/cmd/golden/extraArguments.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -14,15 +13,13 @@ projects: - dev.tfvars - us-east-1.tfvars dir: child -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: no_files_at_all -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -32,16 +29,14 @@ projects: - dev.tfvars - us-east-1.tfvars dir: only_optional_files -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' - ../terraform.tfvars dir: only_required_files -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/extra_dependencies.yaml b/cmd/golden/extra_dependencies.yaml index 32388091..77f09a0e 100644 --- a/cmd/golden/extra_dependencies.yaml +++ b/cmd/golden/extra_dependencies.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/filterInfraLiveNonProd.yaml b/cmd/golden/filterInfraLiveNonProd.yaml index 49d3846d..57abeb9f 100644 --- a/cmd/golden/filterInfraLiveNonProd.yaml +++ b/cmd/golden/filterInfraLiveNonProd.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -12,8 +11,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/qa/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -22,8 +20,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/qa/webserver-cluster -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -32,8 +29,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/stage/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/filterInfraLiveProd.yaml b/cmd/golden/filterInfraLiveProd.yaml index e12e176f..094fecc3 100644 --- a/cmd/golden/filterInfraLiveProd.yaml +++ b/cmd/golden/filterInfraLiveProd.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -12,8 +11,7 @@ projects: - ../../region.hcl - ../env.hcl dir: prod/us-east-1/prod/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/infrastructureLive.yaml b/cmd/golden/infrastructureLive.yaml index 9726d853..2f309d0b 100644 --- a/cmd/golden/infrastructureLive.yaml +++ b/cmd/golden/infrastructureLive.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -12,8 +11,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/qa/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -22,8 +20,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/qa/webserver-cluster -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -32,8 +29,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/stage/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -42,8 +38,7 @@ projects: - ../../region.hcl - ../env.hcl dir: non-prod/us-east-1/stage/webserver-cluster -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -52,8 +47,7 @@ projects: - ../../region.hcl - ../env.hcl dir: prod/us-east-1/prod/mysql -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/invalid_parent_module.yaml b/cmd/golden/invalid_parent_module.yaml index 3425dd06..91e77001 100644 --- a/cmd/golden/invalid_parent_module.yaml +++ b/cmd/golden/invalid_parent_module.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/local_terraform_module.yaml b/cmd/golden/local_terraform_module.yaml index 649970f5..f73b1344 100644 --- a/cmd/golden/local_terraform_module.yaml +++ b/cmd/golden/local_terraform_module.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/mergeParentDependencies.yaml b/cmd/golden/mergeParentDependencies.yaml index 2a9cbf6f..e7e7bada 100644 --- a/cmd/golden/mergeParentDependencies.yaml +++ b/cmd/golden/mergeParentDependencies.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -13,8 +12,7 @@ projects: - ../../parent/folder_under_parent/common_tags.hcl - some_child_dep dir: deep/child -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/multi_accounts_vpc_route53_tgw.yaml b/cmd/golden/multi_accounts_vpc_route53_tgw.yaml index c39ac43a..0fefb1cb 100644 --- a/cmd/golden/multi_accounts_vpc_route53_tgw.yaml +++ b/cmd/golden/multi_accounts_vpc_route53_tgw.yaml @@ -2,15 +2,13 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: network-account/eu-west-1/network/transit-gateway -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' @@ -18,8 +16,7 @@ projects: - ../../../env-a/network/vpc/terragrunt.hcl - ../../../../../network-account/eu-west-1/network/transit-gateway/terragrunt.hcl dir: prod/eu-west-1/_global/route53/test-zone -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/namedWorkflow.yaml b/cmd/golden/namedWorkflow.yaml index 2ac8882e..3430f4ef 100644 --- a/cmd/golden/namedWorkflow.yaml +++ b/cmd/golden/namedWorkflow.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/noParallel.yaml b/cmd/golden/noParallel.yaml index 55fa30e6..1bd04b90 100644 --- a/cmd/golden/noParallel.yaml +++ b/cmd/golden/noParallel.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: false parallel_plan: false projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/no_terraform_blocks.yml b/cmd/golden/no_terraform_blocks.yml index cf216936..6279b587 100644 --- a/cmd/golden/no_terraform_blocks.yml +++ b/cmd/golden/no_terraform_blocks.yml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' @@ -11,38 +10,33 @@ projects: - ../network/terragrunt.hcl - ../../stage/network/terragrunt.hcl dir: myproject/eu-south-1/infra/apps -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' - '*.tf*' - ../../stage/network/terragrunt.hcl dir: myproject/eu-south-1/infra/network -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' - '*.tf*' - ../network/terragrunt.hcl dir: myproject/eu-south-1/stage/dbs -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' - '*.tf*' dir: myproject/eu-south-1/stage/network -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' - '*.tf*' dir: myproject/global/dns -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' diff --git a/cmd/golden/oldWorkflowsPreserved.yaml b/cmd/golden/oldWorkflowsPreserved.yaml index 33b551d5..a2ed1b1a 100644 --- a/cmd/golden/oldWorkflowsPreserved.yaml +++ b/cmd/golden/oldWorkflowsPreserved.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/parentAndChildDefinedWorkflow.yaml b/cmd/golden/parentAndChildDefinedWorkflow.yaml index 8d4955d0..a6c37ae1 100644 --- a/cmd/golden/parentAndChildDefinedWorkflow.yaml +++ b/cmd/golden/parentAndChildDefinedWorkflow.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/parentDefinedWorkflow.yaml b/cmd/golden/parentDefinedWorkflow.yaml index 2af610a6..cdc64b37 100644 --- a/cmd/golden/parentDefinedWorkflow.yaml +++ b/cmd/golden/parentDefinedWorkflow.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/skip.yaml b/cmd/golden/skip.yaml index 1e75905d..ef8b883c 100644 --- a/cmd/golden/skip.yaml +++ b/cmd/golden/skip.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/terraform_version.yaml b/cmd/golden/terraform_version.yaml index 7980db36..e4bcb9ae 100644 --- a/cmd/golden/terraform_version.yaml +++ b/cmd/golden/terraform_version.yaml @@ -2,24 +2,21 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: inherit_from_parent terraform_version: 0.12.9001 -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: override_parent terraform_version: 0.13.9001 -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/terragrunt_dependency.yaml b/cmd/golden/terragrunt_dependency.yaml index a5167c3c..df421ee0 100644 --- a/cmd/golden/terragrunt_dependency.yaml +++ b/cmd/golden/terragrunt_dependency.yaml @@ -2,15 +2,13 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: dependency -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/terragrunt_dependency_ignored.yaml b/cmd/golden/terragrunt_dependency_ignored.yaml index 81f1dd64..4c13e945 100644 --- a/cmd/golden/terragrunt_dependency_ignored.yaml +++ b/cmd/golden/terragrunt_dependency_ignored.yaml @@ -2,15 +2,13 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: dependency -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/withAutomerge.yaml b/cmd/golden/withAutomerge.yaml index be606a15..c2d836aa 100644 --- a/cmd/golden/withAutomerge.yaml +++ b/cmd/golden/withAutomerge.yaml @@ -2,8 +2,7 @@ automerge: true parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/withAutoplan.yaml b/cmd/golden/withAutoplan.yaml index 816e45d1..fe47c3ed 100644 --- a/cmd/golden/withAutoplan.yaml +++ b/cmd/golden/withAutoplan.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: true when_modified: - '*.hcl' diff --git a/cmd/golden/withParent.yaml b/cmd/golden/withParent.yaml index 7553cfa3..0efec26f 100644 --- a/cmd/golden/withParent.yaml +++ b/cmd/golden/withParent.yaml @@ -2,15 +2,13 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' - '*.tf*' dir: . -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/withProjectName.yaml b/cmd/golden/withProjectName.yaml index a52f2d09..462a4a13 100644 --- a/cmd/golden/withProjectName.yaml +++ b/cmd/golden/withProjectName.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/withWorkspace.yaml b/cmd/golden/withWorkspace.yaml index c9c5c39b..b8749a61 100644 --- a/cmd/golden/withWorkspace.yaml +++ b/cmd/golden/withWorkspace.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/golden/withoutParent.yaml b/cmd/golden/withoutParent.yaml index d855ff07..74a7bed3 100644 --- a/cmd/golden/withoutParent.yaml +++ b/cmd/golden/withoutParent.yaml @@ -2,8 +2,7 @@ automerge: false parallel_apply: true parallel_plan: true projects: -- apply_requirements: [] - autoplan: +- autoplan: enabled: false when_modified: - '*.hcl' diff --git a/cmd/parse_locals.go b/cmd/parse_locals.go index f4c48f4d..d5c6efb2 100644 --- a/cmd/parse_locals.go +++ b/cmd/parse_locals.go @@ -147,6 +147,7 @@ func resolveLocals(localsAsCty cty.Value) ResolvedLocals { applyReqs, ok := rawLocals["atlantis_apply_requirements"] if ok { + resolved.ApplyRequirements = []string{} it := applyReqs.ElementIterator() for it.Next() { _, val := it.Element() diff --git a/main.go b/main.go index 52d2e42a..f4d6051f 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ import "github.com/transcend-io/terragrunt-atlantis-config/cmd" // This variable is set at build time using -ldflags parameters. // But we still set a default here for those using plain `go get` downloads // For more info, see: http://stackoverflow.com/a/11355611/483528 -var VERSION string = "1.3.0" +var VERSION string = "1.3.1" func main() { cmd.Execute(VERSION) diff --git a/test_examples/apply_requirements_overrides/child_that_overrides_to_empty/terragrunt.hcl b/test_examples/apply_requirements_overrides/child_that_overrides_to_empty/terragrunt.hcl new file mode 100644 index 00000000..ceefd2f2 --- /dev/null +++ b/test_examples/apply_requirements_overrides/child_that_overrides_to_empty/terragrunt.hcl @@ -0,0 +1,15 @@ +include { + path = find_in_parent_folders() +} + +terraform { + source = "git::git@github.com:transcend-io/terraform-aws-fargate-container?ref=v0.0.4" +} + +locals { + atlantis_apply_requirements = [] +} + +inputs = { + foo = "bar" +} \ No newline at end of file diff --git a/test_examples/apply_requirements_overrides/standalone_module_that_does_not_specify/terragrunt.hcl b/test_examples/apply_requirements_overrides/standalone_module_that_does_not_specify/terragrunt.hcl new file mode 100644 index 00000000..892c93c2 --- /dev/null +++ b/test_examples/apply_requirements_overrides/standalone_module_that_does_not_specify/terragrunt.hcl @@ -0,0 +1,7 @@ +terraform { + source = "git::git@github.com:transcend-io/terraform-aws-fargate-container?ref=v0.0.4" +} + +inputs = { + foo = "bar" +} \ No newline at end of file diff --git a/test_examples/apply_requirements_overrides/standalone_module_that_specifies/terragrunt.hcl b/test_examples/apply_requirements_overrides/standalone_module_that_specifies/terragrunt.hcl new file mode 100644 index 00000000..65c93b0d --- /dev/null +++ b/test_examples/apply_requirements_overrides/standalone_module_that_specifies/terragrunt.hcl @@ -0,0 +1,11 @@ +terraform { + source = "git::git@github.com:transcend-io/terraform-aws-fargate-container?ref=v0.0.4" +} + +locals { + atlantis_apply_requirements = ["mergeable"] +} + +inputs = { + foo = "bar" +} \ No newline at end of file diff --git a/test_examples/apply_requirements_overrides/standalone_module_that_specifies_empty/terragrunt.hcl b/test_examples/apply_requirements_overrides/standalone_module_that_specifies_empty/terragrunt.hcl new file mode 100644 index 00000000..296df3b8 --- /dev/null +++ b/test_examples/apply_requirements_overrides/standalone_module_that_specifies_empty/terragrunt.hcl @@ -0,0 +1,11 @@ +terraform { + source = "git::git@github.com:transcend-io/terraform-aws-fargate-container?ref=v0.0.4" +} + +locals { + atlantis_apply_requirements = [] +} + +inputs = { + foo = "bar" +} \ No newline at end of file