Skip to content

Commit

Permalink
Merge pull request #49 from cloudposse/refactor-warning
Browse files Browse the repository at this point in the history
chore: refactor deletion warning message
  • Loading branch information
milldr authored Dec 6, 2023
2 parents 4f4efc5 + 0f85f92 commit 4603974
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-failed-plan-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ jobs:
```hcl
Error: Invalid function argument
on main.tf line 10, in locals:
10: failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
on main.tf line 16, in locals:
16: failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
├────────────────
│ while calling file(path)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-failed-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
actual: "${{ fromJSON(needs.test.outputs.summary) }}"
expected: |
## Plan Failed for `foobar-fail` in `plat-ue2-sandbox`
<a href="https://cloudposse.com/"><img src="https://cloudposse.com/logo-300x69.svg" width="100px" align="right"/></a>
[![failed](https://shields.io/badge/PLAN-FAILED-ff0000?style=for-the-badge)](#user-content-result-plat-ue2-sandbox-foobar-fail)
Expand All @@ -95,8 +95,8 @@ jobs:
```hcl
Error: Invalid function argument
on main.tf line 10, in locals:
10: failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
on main.tf line 16, in locals:
16: failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
├────────────────
│ while calling file(path)
Expand Down
8 changes: 7 additions & 1 deletion components/terraform/foobar/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ resource "random_id" "foo" {
seed = "${module.this.id}-${var.example}"
}
byte_length = 8

lifecycle {
ignore_changes = [
keepers["timestamp"]
]
}
}

locals {
failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
}
}
5 changes: 3 additions & 2 deletions config/summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ templates:
deletion_warning: |
{{if .HasDestroy}}
### :warning: Resource Deletion will happen :warning:
This plan contains resource delete operation. Please check the plan result very carefully!
> [!CAUTION]
**Terraform will delete resources!**
This plan contains resource delete operations. Please check the plan result very carefully.
{{end}}
change_inside_terraform: |
Expand Down

0 comments on commit 4603974

Please sign in to comment.