https://www.runatlantis.io/ logo
Title
a

Anas Kadam

03/20/2023, 7:26 PM
Hey folks, Just wondering if this scenario is possible to do with Atlantis: 1. On PR creation,
atlantis
plans without locking 2. On PR approval and passing merge checks,
atlantis
plans with locking and applies I tried looking into custom workflows, and my idea was to use two custom workflows: 1. Workflow 1: plans without locking without any requirements 2. Workflow 2: plans and applies with approved and mergeable requirements But I am unsure how to null or not execute apply on workflow 1. The issue we have is we want
atlantis
locking but run into frequent issues where someone else grabs a lock and the PR is not in a mergeable or approved state. It wastes time to ask the PR owner to unlock and leads into lock contention.
p

PePe Amengual

03/20/2023, 7:41 PM
I do not think that is possible
a

Anas Kadam

03/20/2023, 7:48 PM
There is an argument
-lock=false
that we can use, no?
p

PePe Amengual

03/20/2023, 7:52 PM
but that is for all commands…..mmmmm wait
it is possible per project
in the atlantis.yaml I forgot about this
- plan:
          extra_args: ["-lock", "false"]
repo_locking: false
is what you want
a

Anas Kadam

03/20/2023, 7:57 PM
I understand that we can lock/unlock per step. What I want is multiple workflow where one workflow is just plan without lock and another workflow with plan with lock
p

PePe Amengual

03/20/2023, 7:58 PM
this is exactly what that is
you will need to pass it per project
a

Anas Kadam

03/20/2023, 7:59 PM
the project is the same
p

PePe Amengual

03/20/2023, 7:59 PM
ahhhhh
so then you can do :
workflows:
  myworkflow:
    plan:
      steps:
      - run: my-custom-command arg1 arg2
      - init
      - plan:
          extra_args: ["-lock", "false"]
      - run: my-custom-command arg1 arg2
    apply:
      steps:
      - run: echo hi
      - apply
but actually even if the project is the same
repo_locking: false
will work
because you do not care about lock on plan
only on apply
a

Anas Kadam

03/20/2023, 8:01 PM
I do want to lock just before apply to prevent merge conflicts
p

PePe Amengual

03/20/2023, 8:01 PM
just before apply? there is no state like that
is per command
a

Anas Kadam

03/20/2023, 8:02 PM
So flow I want is: 1. PR created 2. Atlantis plan without locking 3. PR approved, merge checks pass 4. Atlantis plan with lock 5. Atlantis apply 6. PR merge 7. Atlantis unlocks
is that possible
p

PePe Amengual

03/20/2023, 8:03 PM
that will only be possible if you pass the arg to the command
atlantis plan -lock=false
manually
a

Anas Kadam

03/20/2023, 8:03 PM
gotcha
Thank you, appreciate this
p

PePe Amengual

03/20/2023, 8:03 PM
you can’t do it that way at the workflow level