Hey folks, i'm playing around with the atlantis ap...
# atlantis-community
s
Hey folks, i'm playing around with the atlantis api.
Copy code
curl --request POST '<https://xxxxxxxxxxx/api/plan>' \
--header 'X-Atlantis-Token: xxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "Repository": "path/to/repo",
    "Ref": "featurebranch",
    "Type": "Gitlab",
    "Paths": [{
      "Directory": "path/to/terraformdir",
      "Workspace": "workspacename"
    }]
}' | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   922  100   641  100   281    188     82  0:00:03  0:00:03 --:--:--   270
{
  "Error": null,
  "Failure": "",
  "ProjectResults": [
    {
      "Command": 1,
      "SubCommand": "",
      "RepoRelDir": "path/to/terraformdir",
      "Workspace": "workspacename",
      "Error": null,
      "Failure": "This project is currently locked by an unapplied plan from pull !2. To continue, delete the lock from !2 or apply that plan and merge the pull request.\n\nOnce the lock is released, comment `atlantis plan` here to re-plan.",
      "PlanSuccess": null,
      "PolicyCheckResults": null,
      "ApplySuccess": "",
      "VersionSuccess": "",
      "ImportSuccess": null,
      "StateRmSuccess": null,
      "ProjectName": "projectname"
    }
  ],
  "PlansDeleted": false
}
is there a way for me to force it to run plan? i don't want to run apply after.
i understand the reason for locking. in my use case, i want to detect drift in the env. sometimes users run plan with wildcards and don't unlock the workspaces after. which is fine, but i can't run my script to detect drift while it is locked.
p
mmmm
I do not think you can run a plan even if there is a lock
Copy code
# repo_locking defines whether lock repository when planning.
  # If true (default), atlantis try to get a lock.
  repo_locking: true
you could potentially use that
do it locks on apply not plan
for example
s
https://atlantis-community.slack.com/archives/C5MGGAV0C/p1711401183610989?thread_ts=1711398927.272649&amp;cid=C5MGGAV0C on this, is it possible to pass this option when calling the api endpoint? i don't see a documented, so it seems like it would not be possible.
https://atlantis-community.slack.com/archives/C5MGGAV0C/p1711401691928089?thread_ts=1711398927.272649&amp;cid=C5MGGAV0C i saw this also, strongly considering this one. seems very cool. just trying to think, what could possibly go wrong using this....
p
at the end of the day the apply is what matters most
so if you do not have repo locking at plan you could potentially have issues with TF locks for remote state calls
but no atlantis locks
s
yeah i see
thanks for the prompt response @PePe Amengual
one more question , do you know when this feature will be released? https://github.com/runatlantis/atlantis/pull/3879/files
p
soon ish
I will say in about 2 weeks or so
s
great
p
you can use the dev image to test it out
in the PR you will find an image
s
thx