Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/8695 #9098

Merged
merged 1 commit into from
Jan 27, 2025
Merged

issue/8695 #9098

merged 1 commit into from
Jan 27, 2025

Conversation

mikereiddigital
Copy link
Contributor

@mikereiddigital mikereiddigital commented Jan 27, 2025

A reference to the issue / Description of it

#8695

How does this PR fix the problem?

This adds a check on the number of resources identified to be destroyed in the plan output. If greater or equal to the set threshold then a warning will be displayed along with a review request. This is achieved by the following:

  1. A new environment variable in the reusable-plan-and-apply workflow - that sets this threshold. Initially set to 10.
  2. A new bash script that greps the output of the "show" step in the above workflow, obtains from it the number of resources to be destroyed from the plan and outputs depending on the result.
  3. Two new steps for the reusable-plan-and-apply workflow - the exec of the above bash script and a step that generates a review request should the destroy threshold be met or exceeded.

Example of the output:

image

How has this been tested?

Please describe the tests that you ran and provide instructions to reproduce.

Tested extensively - for example #9084.

Deployment Plan / Instructions

Will this deployment impact the platform and / or services on it?

{Please write here}

Checklist (check x in [ ] of list items)

  • I have performed a self-review of my own code
  • All checks have passed
  • I have made corresponding changes to the documentation
  • Plan and discussed how it should be deployed to PROD (If needed)

Additional comments (if any)

There is the potential to encapsulate this in a standalone reusable workflow.

…ed in the plan output. If greater or equal to the set threshold then a warning will be displayed along with a review request.
@mikereiddigital mikereiddigital requested a review from a team as a code owner January 27, 2025 10:48
Copy link
Contributor

Terraform Plan Summary

single-sign-on
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

modernisation-platform-account
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

pagerduty
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-development
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-preproduction
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-test
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.9.1)
tflint will check the following folders:

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:

Copy link
Contributor

Terraform Plan Summary

single-sign-on
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

modernisation-platform-account
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-security-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

pagerduty
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-logging-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

single-sign-on
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-network-services-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

modernisation-platform-account
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

pagerduty
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-shared-services-production
Plan: 0 to add, 1 to change, 0 to destroy.

@mikereiddigital mikereiddigital added this pull request to the merge queue Jan 27, 2025
Merged via the queue into main with commit 024d916 Jan 27, 2025
48 of 51 checks passed
@mikereiddigital mikereiddigital deleted the issue/8695 branch January 27, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants