atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

atlantis custom commands instead of just `plan` and `apply`

Open nitrocode opened this issue 4 years ago • 4 comments

Problems

When I run the apply command, my workflow will assume the role engineer but sometimes I want it to assume the role mega-engineer for more permissions.

I can do this using an assume role in my aws provider BUT I'd like to do this directly from an atlantis gh comment without modifying the existing tf code.

I'd also like to be explicit and not always assume the elevated iam role. Our default iam role is the engineer role so if that will suffice, then that's ok. If this fails, then we can try again with the elevated role.

Solutions

I'd like to run variation of the apply command using atlantis apply for engineer role and atlantis applymega for mega-engineer role.

server atlantis.yaml

workflows:
  applystuff:
    apply:
      steps:
        - run: AWS_PROFILE=engineer terraform apply -no-color $PLANFILE
    applymega:
      steps:
        - run: AWS_PROFILE=mega-engineer terraform apply -no-color $PLANFILE

repo atlantis.yaml

version: 3
projects:
- dir: .
  terraform_version: v0.14.6
  workflow: applystuff

nitrocode avatar Apr 12 '21 16:04 nitrocode

You can already have custom run steps that'll allow you to have different workflows you can transition between so the fallback case would be covered there.

Support completely custom commands is out of scope for atlantis. Code complexity will just increase and Atlantis at that point kind of just becomes a workflow engine.

nishkrishnan avatar Apr 18 '21 23:04 nishkrishnan

You can already have custom run steps that'll allow you to have different workflows you can transition between so the fallback case would be covered there.

As described in the original post, this unfortunately does not satisfy the use case.

Support completely custom commands is out of scope for atlantis. Code complexity will just increase and Atlantis at that point kind of just becomes a workflow engine.

Perhaps the solution I proposed is not the best, but would you have an alternative that would work?

Basically what I'd need is the ability to change the workflow based on a comment w/o changing the code. In this case, I'd like to optionally change an environment variable for an atlantis plan / atlantis apply.

Perhaps, the environment name and value could be allowlisted in the workflow itself and then if the user tried to change it to an appropriate value, it would work, otherwise it would not.

nitrocode avatar Apr 20 '21 14:04 nitrocode

Hi!, any updates in this issue?

carmennavarreteh avatar May 04 '23 09:05 carmennavarreteh

We're also interested!

ribejara-te avatar Jun 19 '24 08:06 ribejara-te