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

Auto plan runs after initial plan upon any file change. Filters ignored #5326

Open
timvia opened this issue Feb 13, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@timvia
Copy link

timvia commented Feb 13, 2025

Overview of the Issue

We have a set of terraform plans that on completion creates config files which are then commited via workflow steps.

The issue we have is that we use autoplan and automerge. Upon the commit atlantis re-runs the plan even though no .tf files have been edited. Our created files are only .yml. This commit and autoplan blocks the automerge from completing.

Atlantis version v0.32.0

Example atlantis.yaml

---
version: 3
automerge: true

projects:
- name: project name
  dir: ./project/terraform
  workspace: default
  delete_source_branch_on_merge: true
  autoplan:
    when_modified: ["*.tf"]
    enabled: true
  apply_requirements: [mergeable]
  workflow: deployment_workflow

workflows
  deployment_workflow:
    plan:
      steps: [init, plan]
    apply:
      steps:
        - apply
        - run: |
            #!/bin/bash
            set -euxo pipefail

            cd $DIR/..
            if ! git diff --exit-code; then
              git add .
              git commit -m "chore: Adding terraform generated files" --author="atlantis <[email protected]>"
              git push
            fi

Describe the solution you'd like

Atlantis should not be triggering a plan, no *.tf files were modified. The files are also outside of the project folder ./project/config.

Explicitly ignoring .yml does not prevent the plan. It seems that after an initial commit requiring a plan to be triggered will then trigger a new plan upon any file change. It is ignoring the filter.

To work around this we have to disable auto plan.

@timvia timvia added the bug Something isn't working label Feb 13, 2025
Copy link

dosubot bot commented Feb 13, 2025

Hello, @timvia! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together!

I found a similar closed issue titled "Atlantis fails on PR that contains no TF changes," but no solution was found in the comments [1].

To address your issue, ensure that your atlantis.yaml configuration is correctly set to prevent autoplan from triggering on non-.tf file changes. It seems like your current configuration should work, as it specifies when_modified: ["*.tf"]. However, if Atlantis is still triggering plans on .yml file changes, you might want to verify that there are no other configurations or defaults causing this behavior.

Additionally, ensure that the when_modified field is correctly scoped to the project directory and that no other global settings are overriding it. If the problem persists, consider explicitly specifying the directories or file patterns that should trigger autoplan, ensuring that .yml files are not included unless necessary.

If these steps do not resolve the issue, you might need to explore further configuration options or potential updates in newer versions of Atlantis that address this behavior.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report

@timvia
Copy link
Author

timvia commented Feb 13, 2025

previously logged and workaround requested for SKIP CI, this was rejected. The comments here you can see this was discovered to be a bug

#5002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant