atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

feature request: UI button to trigger atlantis for reconciling environment drift

Open tekumara opened this issue 3 years ago • 1 comments

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

Sometimes our environment drifts because of changes made outside terraform. To reconcile our environment with the source, we need to trigger atlantis without making changes to the repo.

Currently, this can be done by creating an empty commit and raising a PR. But it would be nice if this could be triggered via a button on the UI.

tekumara avatar Feb 20 '22 05:02 tekumara

PR https://github.com/runatlantis/atlantis/pull/997 would allow us to run plans and applies across Atlantis repos. It would not complete the cycle but it would be a step towards detecting drift.

Then Atlantis would need to discover the terraform root modules to apply, show each in the user interface, and expose a plan or trigger button, and a way to trigger Atlantis terraform plan jobs on a configurable cron.

This would implement a crude version of terraform Enterprise / spacelift user interfaces.

nitrocode avatar Jul 14 '22 17:07 nitrocode

bump

tekumara avatar Oct 09 '22 04:10 tekumara

This is a pretty big ticket but I would imagine this could be accomplished in smaller steps.

Now that /plan and /apply, the next thing we need is to display atlantis projects. The easiest way to do that is to:

  1. Detect all repos that are terraform repos (either explicitly set or by the regex)
  2. Read a repo's atlantis.yaml file and parse the yaml's projects key.
    • If there isn't one, perhaps we can auto discover root terraform projects ? This would be difficult with workspaces.
    • If no workspaces, we'd have to look for projects with a terraform backend configured for example.
  3. For each project, display it in the index.html file containing important information. This would require a new endpoint to retrieve the information to display it in the UI.
    • project name (if it exists)
    • directory path
    • terraform version
    • github org / github repo
    • branch (optional)
    • workspace
    • commit hash (optional)
    • last apply
    • any special tags
  4. Allow clicking on the project to go to a new project page. This would be a new endpoint. For high cardinality, we could use a format like /<org>/<repo>/<dir>/<workspace>
  5. Project page
    • could show plan/apply/deploy buttons
    • where deploy is terraform apply -auto-approve
    • click plan to create a job id with a link to the job
    • job can show the plan in real-time (like it does now)
    • plan has to pass in order to apply

Maybe something like this on index.html

2022-11-09_20-22

nitrocode avatar Nov 10 '22 02:11 nitrocode