atlantis
atlantis copied to clipboard
Atlantis runs apply only on the last planned directory in the same PR
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
Atlantis runs apply only on the last planned directory in the same PR.
For example I have 3 projects planned in my PR:
- dir: test/ec2-instance/memcached workspace: test_ec2-instance_memcached
- dir: test/ec2-instance/redis workspace: test_ec2-instance_redis
- dir: test/ec2-instance/consul workspace: test_ec2-instance_consul
Let's say atlantis plan
succeeds for projects 1 and 3, but fails for the 2nd one due to a timeout issue.
In that case I want to replan it with a separate Atlantis command:
atlantis plan -d test/ec2-instance/redis -w test_ec2-instance_redis
Now the GitHub PR shows succesfull plan status checks for all directories, so we can proceed with an apply command: atlantis apply
.
The issue is that Atlantis ignores the rest of the directories and will only attempt to apply the last planned project:
2. dir: test/ec2-instance/redis workspace: test_ec2-instance_redis
In addition to that, if I have ATLANTIS_HIDE_PREV_PLAN_COMMENTS
variable set to true
, Atlantis also hides all my previous plans, including those that ran only once.
I would like to be able to apply all my projects at once, without considering the plan order.
Environment details
Atlantis version: 0.19.4
Atlantis server-side config file:
repos:
- id: /github.com/org/.*/
workflow: terragrunt
apply_requirements:
- approved
- mergeable
allowed_overrides:
- workflow
allowed_workflows:
- terragrunt
pre_workflow_hooks:
- run: >
terragrunt-atlantis-config generate --output atlantis.yaml --autoplan
--workflow terragrunt --create-workspace --parallel
workflows:
terragrunt:
plan:
steps:
- env:
name: TERRAGRUNT_TFPATH
command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
- env:
name: TF_CLI_ARGS
value: '-no-color'
- env:
name: TF_INPUT
value: '0'
- run: terragrunt run-all validate-inputs --terragrunt-log-level=error
- run: terragrunt run-all plan -out "$PLANFILE"
apply:
steps:
- env:
name: TERRAGRUNT_TFPATH
command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
- env:
name: TF_CLI_ARGS
value: '-no-color'
- env:
name: TF_INPUT
value: '0'
- run: terragrunt run-all apply "$PLANFILE"
Hi,
we have the same problem but with projects and I wanted to open also a issue today for this. 3 of 35 failed, we triggered a plan on each of the 3 failed projects. Afterwards we run a atlantis apply to apply all. But, only the 3 projects are applied and not all. Hope you can fix this.
We use atlantis 0.19.5 with terraform 1.1.7. If you need further information, please let me know.
Our atlantis.yaml (short)
version: 3
automerge: true
parallel_plan: false
parallel_apply: false
projects:
- name: project-1
dir: cld/accounts/1/project
workspace: default
autoplan:
enabled: true
when_modified:
- "**/*.tf"
- "**/*.yaml"
- "**/*.secret"
apply_requirements: [mergeable]
workflow: git-crypt
- name: project-2
dir: cld/accounts/2/project
workspace: default
autoplan:
enabled: true
when_modified:
- "**/*.tf"
- "**/*.yaml"
- "**/*.secret"
apply_requirements: [mergeable, approved]
workflow: git-crypt
- name: project-3
dir: cld/accounts/3/project
workspace: default
autoplan:
enabled: true
when_modified:
- "**/*.tf"
- "**/*.yaml"
- "**/*.secret"
apply_requirements: [mergeable]
workflow: git-crypt
- name: project-4
dir: cld/accounts/4/project
workspace: default
autoplan:
enabled: true
when_modified:
- "**/*.tf"
- "**/*.yaml"
- "**/*.secret"
apply_requirements: [mergeable, approved]
workflow: git-crypt
workflows:
git-crypt:
plan:
steps:
- env:
name: ACCOUNT_ID
command: echo $REPO_REL_DIR |awk -F/ '{print $3}'
- env:
name: AWS_PROFILE
command: echo "${ACCOUNT_ID}"
- env:
name: AWS_SHARED_CREDENTIALS_FILE
command: echo "${HOME}/.aws/credentials"
- init:
extra_args: ["-upgrade=false"]
- run: terraform refresh 1>/dev/null
- run: terraform plan -input=false -refresh=false -no-color -out $PLANFILE
apply:
steps:
- env:
name: ACCOUNT_ID
command: echo $REPO_REL_DIR |awk -F/ '{print $3}'
- env:
name: AWS_PROFILE
command: echo "${ACCOUNT_ID}"
- env:
name: AWS_SHARED_CREDENTIALS_FILE
command: echo "${HOME}/.aws/credentials"
- init:
extra_args: ["-upgrade=false"]
- apply
Problem still exists.
withe the latest version too?
Yes, with v0.19.8
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'
not solved yet
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'
I have noticed this too and it makes me not want to use the -d command.
If a plan of a project fails while other projects succeed, you should be able to plan a directory again without losing all previous plans
Perhaps we need a new flag
atlantis plan -d test/ec2-instance/redis -w test_ec2-instance_redis --keep-other-plans
Thoughts?
I do not use dir ever but I do use projects -p and I do not have this problem when using projects I believe. the plan should be discarded if there are changes on the files ( that belong to the dir/project) or after a successful applybut only for that specific project/dir
interesting. perhaps the behavior for -p
is different for -d
and -w
? If so, it sounds like a bug. They should all be consistent.
@jamengual are you saying that if you proposed a PR and it ran 3 projects, if one of them failed, and you reran it using -p
, it succeeded, and then you did an atlantis apply
, that apply would affect all 3 projects or only the most recent -p
project ?
if you run -p for each project or if they get run by one invocation of atlantis plan
without passing -p?
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'
Still open
Having this issue as well. Seeing it with -p
or -d
and I'm on atlantis versionv0.24.1
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'
This is still happening with latest Atlantis version.
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'
Still relevant
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'