runatlantis/atlantis

Atlantis not running plans on projects with depends_on in atlantis.yaml

Opened this issue ยท 2 comments

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Our infrastructure is based off of https://github.com/terraform-google-modules/terraform-example-foundation
We build our infrastructure in layers 0,1,2,3,4,5...

When we make a terraform change to a lower layer project, we want atlantis to run a plan on the upper layer projects that depend on the lower layer project.

When I make a change to layer 3, I expect atlantis to run a plan on all projects in upper layers that depends_on layer 3. For example, I'm only modifying a project in layer 3 and the project in layer 5 depends_on layer 3 but a plan is not being triggered.

Why doesn't depends_on not trigger a plan on projects in the upper layer projects? Is this expected or is this a bug?

Reproduction Steps

Repo atlantis.yaml file:

#project I modify

`- name: gcp-3-networks
  dir: infrastructure-gcp/3-networks/environments/common
  autoplan:
    when_modified:
    - '*.tf'
    - ../../modules/**/*.tf
    - '**/*tfvars'
  depends_on:
  - gcp-0-bootstrap
  - gcp-1-org
  workspace: gcp-3-networks
  workflow: default
  terraform_version: v1.6.3`
# An upper layer project that depends_on gcp-3-networks project but a plan is not being triggered here.

- name: gcp-5-infra-ci
  dir: infrastructure-gcp/5-infra-ci/environments/common
  autoplan:
    when_modified:
    - '*.tf'
    - ../../modules/**/*.tf
    - '**/*tfvars'
  depends_on:
  - gcp-3-networks
  workspace: gcp-5-3-infra-ci
  workflow: default
  terraform_version: v1.6.3

Environment details

Atlantis server-side config file:

repos:
- id: github.com/xxxx/monorepo
  apply_requirements: [mergeable]
  allowed_overrides: [workflow]

@knjoroge depends_on is used to enforce only the order of execution of plans and applies: https://www.runatlantis.io/docs/repo-level-atlantis-yaml#order-of-planning-applying
it doesn't alter the way auto-planning works for a given project or trigger plans on its own.

@the-nando That is a great shame as it could be much better used. When workspace A depends_on B and B is changed, it feels natural to trigger autoplan for A