abcxyz / guardian

Apache License 2.0
16 stars 1 forks source link

fix: destroy from modifiers #405

Closed verbanicm closed 3 weeks ago

verbanicm commented 3 weeks ago

Guardian shouldn't care if a directory was removed for destroy, there could be a case where we want to just destroy the resources and then run an apply for a clean slate.

Rather the modifier content will be used to determine a destroy phase using the base branch from a pull request and HEAD~1 from main for apply on push.

github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱

Guardian will run for the following directories

Update terraform/project1

Destroy terraform/project2

Help Deleted directories are removed from source control without modification. To destroy an entire directory, add one or more modifier comments to the pull request body instructing Guardian to destroy the directory. ``` GUARDIAN_DESTROY=path/to/directory ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 PLAN (DESTROY) 🟩 SUCCESS [logs]

Entrypoint: terraform/project2

Details ```diff null_resource.empty: Refreshing state... [id=2104409026244402681] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: - destroy Terraform will perform the following actions: # null_resource.empty will be destroyed - resource "null_resource" "empty" { - id = "2104409026244402681" -> null } Plan: 0 to add, 0 to change, 1 to destroy. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 APPLY (DESTROY) 🟩 SUCCESS [logs]

Entrypoint: terraform/project2

Details ```diff null_resource.empty: Destroying... [id=2104409026244402681] null_resource.empty: Destruction complete after 0s Apply complete! Resources: 0 added, 0 changed, 1 destroyed. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 PLAN 🟩 SUCCESS [logs]

Entrypoint: terraform/project1

Details ```diff Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # null_resource.empty will be created + resource "null_resource" "empty" { + id = (known after apply) } Plan: 1 to add, 0 to change, 0 to destroy. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 APPLY 🟩 SUCCESS [logs]

Entrypoint: terraform/project1

Details ```diff null_resource.empty: Creating... null_resource.empty: Creation complete after 0s [id=7233199036615228133] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ```