atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

Infer apply order from atlantis.yaml

Open b-m-f opened this issue 4 years ago • 9 comments

I have a problem with the order of modules getting applied.

This might not be an issue with pure terraform, but the setup is using terragrunt.

All dependencies are described correctly in my atlantis.yaml file.

Maybe it is possible to infer the order in which applies should be triggered by reading the config file and applying those modules, that others in an MR depend on, first?

I am willing to help out on implementing this if this is a feature that seems beneficial to the overall project and you could give me some pointers.

Example

  1. VPC
  2. Worker Instance -> WI
  3. Networking Rules -> NR

Both NR and WI depend on the VPC. Apply VPC first.

WI depends on NR. Apply NR next.

Apply WI last.

In atlantis.yaml form

When VPC changes, update both WI and NR -> apply first

When NR changes, update WI -> apply first

b-m-f avatar Nov 13 '20 07:11 b-m-f

Yes this would be nice. Also I am a little annoyed with that changes in dependencies are not shown in plans, in the example above an atlantis plan would show "no changes" in NR and WI would not be visible until VPC is applied. I understand that terraform need to update the output (which it does at apply) before it can get the those values to input in the dependee.. This could either be solved by applying them all in order as suggested here (and then not only show "apply succesfull" but show what actually has changed in the apply, since it would not be shown in the earlier plan.. It could also be nice to run an extra plan after each apply.. and only show results if there are any new changes.

tomasbackman avatar Nov 23 '20 15:11 tomasbackman

Good idea! For the plan issue, an option to wait for dependencies to plan the modules would be nice indeed. Apply could trigger automatically the remaining plans of any module depending on this apply as well.

thomas-desforges avatar Nov 24 '20 12:11 thomas-desforges

@lkysow What do you think?

I wouldn't start on this if its not desired in the project :)

b-m-f avatar Dec 03 '20 09:12 b-m-f

This would be a great feature to have. My team was just discussing if there was a way to have atlantis apply dev before it applies prod even though maybe atlantis apply was the only thing in the comment. Or having an exception in the server config file that for a specific stage atlantis apply needs to be explicit or it wont run.

45cali avatar Dec 17 '20 00:12 45cali

if atlantis had an API, you could read the apply status, and using the github api to write the specific apply comments.

ghostsquad avatar Jun 30 '21 21:06 ghostsquad

I've always wanted an apply order or dependency graph

ghostsquad avatar Jun 30 '21 21:06 ghostsquad

Hi, do we have this feature enabled now?

neethu-p avatar Sep 20 '21 08:09 neethu-p

Hi i'm needing this feature, is enabled?

eechava66 avatar Sep 24 '21 16:09 eechava66

is this still relevant needed or tested with v0.19.8?

jamengual avatar Aug 26 '22 07:08 jamengual

I believe this is now implemented with execution_order_group

https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#order-of-planning-applying

nitrocode avatar Dec 29 '22 02:12 nitrocode