Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with duplicate depends on when using extra_arguments #365

Open
trahim opened this issue Dec 26, 2024 · 0 comments
Open

Issues with duplicate depends on when using extra_arguments #365

trahim opened this issue Dec 26, 2024 · 0 comments

Comments

@trahim
Copy link

trahim commented Dec 26, 2024

Bug report

When generating using --depends-on and extra_arguments in the terraform block, you end up with repeated dependencies

To Reproduce

Summarize how to reproduce the behavior. For example:

  1. Create a dependency terragrunt file that looks like
terraform {
  source = "git::[email protected]:transcend-io/terraform-aws-fargate-container?ref=v0.0.4"
  extra_arguments "extra" {
    commands = get_terraform_commands_that_need_vars()
    optional_var_files = [
      "${get_terragrunt_dir()}/extra.tfvars",
    ]
  }
}

inputs = {
  foo = "bar"
}
  1. Run the command terragrunt-atlantis-config generate --output atlantis.yaml --autoplan --parallel --depends-on --create-project-name

Expected behavior

Output to look like

automerge: false
parallel_apply: true
parallel_plan: true
projects:
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - extra.tfvars
  dir: dependency
  name: dependency
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - ../dependency/terragrunt.hcl
    - ../dependency/extra.tfvars
  depends_on:
  - dependency
  - dependency
  dir: depender
  name: depender
version: 3

Actual behavior

Extra dependency

automerge: false
parallel_apply: true
parallel_plan: true
projects:
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - extra.tfvars
  dir: dependency
  name: dependency
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - ../dependency/terragrunt.hcl
    - ../dependency/extra.tfvars
  depends_on:
  - dependency
  dir: depender
  name: depender
version: 3

Relevant Terragrunt files

I've created a PR with test scenarios, where I've just made the append to dependsOnList only allow unique project names. It might be a primitive solution but should handle any future use cases. but open to suggestions.

@trahim trahim changed the title Issues with mutliple depends on when using extra_arguments Issues with duplicate depends on when using extra_arguments Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant