runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.81k stars 1.06k forks source link

Provide summary line for each project outside <details> #914

Closed jsoref closed 2 days ago

jsoref commented 4 years ago

We're playing w/ atlantis for terraform, and it occasionally generates output where some projects need changes and others don't. Having to expand the details for each project when some do/some don't is moderately inefficient. I think it'd be pretty easy

Current behavior

Ran Plan for 12 projects:

  1. project: mongoose dir: terraform/mongoose workspace: default ...
  2. project: tortoise dir: terraform/tortoise workspace: default ...

1. project: mongoose dir: terraform/mongoose workspace: default

Show Output ```diff Initializing the backend... ... ------------------------------------------------------------------------ An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create ~ update in-place - destroy Terraform will perform the following actions: ... Plan: 6 to add, 3 to change, 1 to destroy. ------------------------------------------------------------------------ This plan was saved to: ... To perform exactly these actions, run the following command to apply: terraform apply ... ``` * :arrow_forward: To **apply** this plan, comment: * `atlantis apply -p mongoose` * :put_litter_in_its_place: To **delete** this plan click [here](...) * :repeat: To **plan** this project again, comment: * `atlantis plan -p mongoose`

...


9. project: tortoise dir: terraform/tortoise workspace: default

Show Output ```diff Initializing the backend... ... ------------------------------------------------------------------------ No changes. Infrastructure is up-to-date. This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed. ``` * :arrow_forward: To **apply** this plan, comment: * `atlantis apply -p tortoise` * :put_litter_in_its_place: To **delete** this plan click [here](...) * :repeat: To **plan** this project again, comment: * `atlantis plan -p tortoise`

...

Desired Behavior

Ran Plan for 12 projects:

  1. project: mongoose dir: terraform/mongoose workspace: default ...
  2. project: tortoise dir: terraform/tortoise workspace: default ...

1. project: mongoose dir: terraform/mongoose workspace: default

Plan: 6 to add, 3 to change, 1 to destroy.

Show Output ```diff Initializing the backend... ... ------------------------------------------------------------------------ An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create ~ update in-place - destroy Terraform will perform the following actions: ... Plan: 6 to add, 3 to change, 1 to destroy. ------------------------------------------------------------------------ This plan was saved to: ... To perform exactly these actions, run the following command to apply: terraform apply ... ``` * :arrow_forward: To **apply** this plan, comment: * `atlantis apply -p mongoose` * :put_litter_in_its_place: To **delete** this plan click [here](...) * :repeat: To **plan** this project again, comment: * `atlantis plan -p mongoose`

...


9. project: tortoise dir: terraform/tortoise workspace: default

No changes. Infrastructure is up-to-date.

Show Output ```diff Initializing the backend... ... ------------------------------------------------------------------------ No changes. Infrastructure is up-to-date. This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed. ``` * :arrow_forward: To **apply** this plan, comment: * `atlantis apply -p tortoise` * :put_litter_in_its_place: To **delete** this plan click [here](...) * :repeat: To **plan** this project again, comment: * `atlantis plan -p tortoise`

...

lkysow commented 4 years ago

Are you using a custom workflow? I think the built-in plan step cleans up the "initializing backend" messages and so if there was no changes then the output would be small enough that it wouldn't get wrapped in "Show output".

jsoref commented 4 years ago

@lkysow: we're now using built-in plan step.

w/ the built-in plan, for:

lkysow commented 4 years ago

Yes I think that would be useful. It would need to be tested against various TF versions in case their output formats changed.

To implement the PlanSuccess struct could have a new field Summary. Then you could have a function that pulls the summary out of the plan output. The markdown_renderer would then use that data in its templates.

angeloskaltsikis commented 4 years ago

To bring life back to this feature request, it would be great if we can have something like that. Also i was thinking of the last Atlantis comment to be a summary of all the Plans. The main idea behind this is to quickly review a PR that has multiple different plans (if one uses Terragrunt he could have a huge number of Plans). I am not sure how exactly this may look but just sharing the thought of it.

jsoref commented 2 days ago

?