diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml
index dc529327..014cd964 100644
--- a/.github/workflows/test-changes-exists-drift.yml
+++ b/.github/workflows/test-changes-exists-drift.yml
@@ -186,6 +186,14 @@ jobs:
}
Plan: 1 to add, 0 to change, 0 to destroy.
+
+ Warning: Test warning summary
+
+ with data.validation_warning.warn[0],
+ on main.tf line 20, in data "validation_warning" "warn":
+ 20: data "validation_warning" "warn" {
+
+ Test warning details
```
@@ -193,6 +201,17 @@ jobs:
+ > [!WARNING]
+ > ```
+ > Warning: Test warning summary
+ >
+ > with data.validation_warning.warn[0],
+ > on main.tf line 20, in data "validation_warning" "warn":
+ > 20: data "validation_warning" "warn" {
+ >
+ > Test warning details
+ > ```
+
Metadata
diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml
index 67fb9786..5c21c236 100644
--- a/.github/workflows/test-changes-exists.yml
+++ b/.github/workflows/test-changes-exists.yml
@@ -126,9 +126,29 @@ jobs:
}
Plan: 1 to add, 0 to change, 0 to destroy.
+
+ Warning: Test warning summary
+
+ with data.validation_warning.warn[0],
+ on main.tf line 20, in data "validation_warning" "warn":
+ 20: data "validation_warning" "warn" {
+
+ Test warning details
```
+
+
+ > [!WARNING]
+ > ```
+ > Warning: Test warning summary
+ >
+ > with data.validation_warning.warn[0],
+ > on main.tf line 20, in data "validation_warning" "warn":
+ > 20: data "validation_warning" "warn" {
+ >
+ > Test warning details
+ > ```
teardown:
diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml
index 92bc2cfc..d5e82b15 100644
--- a/.github/workflows/test-infra-cost.yml
+++ b/.github/workflows/test-infra-cost.yml
@@ -130,11 +130,30 @@ jobs:
}
Plan: 1 to add, 0 to change, 0 to destroy.
+
+ Warning: Test warning summary
+
+ with data.validation_warning.warn[0],
+ on main.tf line 20, in data "validation_warning" "warn":
+ 20: data "validation_warning" "warn" {
+
+ Test warning details
```
+ > [!WARNING]
+ > ```
+ > Warning: Test warning summary
+ >
+ > with data.validation_warning.warn[0],
+ > on main.tf line 20, in data "validation_warning" "warn":
+ > 20: data "validation_warning" "warn" {
+ >
+ > Test warning details
+ > ```
+
Infracost Estimate: monthly cost will not change
@@ -145,6 +164,8 @@ jobs:
```
+
+
teardown:
runs-on: ubuntu-latest
diff --git a/config/summary.yaml b/config/summary.yaml
index f7277e9e..2537ddc5 100644
--- a/config/summary.yaml
+++ b/config/summary.yaml
@@ -94,8 +94,8 @@ templates:
deletion_warning: |
{{if .HasDestroy}}
> [!CAUTION]
- **Terraform will delete resources!**
- This plan contains resource delete operations. Please check the plan result very carefully.
+ > **Terraform will delete resources!**
+ > This plan contains resource delete operations. Please check the plan result very carefully.
{{end}}
change_inside_terraform: |
@@ -115,18 +115,24 @@ templates:
{{end}}
warning: |
{{if .Warning}}
- ## :warning: Warnings :warning:
- {{wrapCode .Warning}}
+ > [!WARNING]
+ > ```
+ {{- range ( .Warning | splitList "\n") }}
+ > {{ . | avoidHTMLEscape -}}
+ {{- end}}
+ > ```
{{end}}
+
error_messages: |
{{ if eq .ExitCode 1 }}
---
{{wrapCode .Result }}
{{end}}
{{if .ErrorMessages}}
- ## :warning: Errors
- {{range .ErrorMessages}}
- * {{. -}}
+ > [!CAUTION]
+ > :warning: Errors
+ {{- range .ErrorMessages}}
+ > * {{. -}}
{{- end}}{{end}}
infracost: |
diff --git a/tests/components/terraform/foobar/main.tf b/tests/components/terraform/foobar/main.tf
index 23c2e521..20f9efb8 100644
--- a/tests/components/terraform/foobar/main.tf
+++ b/tests/components/terraform/foobar/main.tf
@@ -16,3 +16,14 @@ resource "random_id" "foo" {
locals {
failure = var.enabled && var.enable_failure ? file("Failed because failure mode is enabled") : null
}
+
+data "validation_warning" "warn" {
+ count = var.enable_warning ? 1 : 0
+ condition = true
+ summary = "Test warning summary"
+ details = "Test warning details"
+}
+
+provider "validation" {
+ # Configuration options
+}
diff --git a/tests/components/terraform/foobar/variables.tf b/tests/components/terraform/foobar/variables.tf
index 09193889..0bdd9fa3 100644
--- a/tests/components/terraform/foobar/variables.tf
+++ b/tests/components/terraform/foobar/variables.tf
@@ -7,4 +7,10 @@ variable "enable_failure" {
type = bool
default = false
description = "Always fail"
-}
\ No newline at end of file
+}
+
+variable "enable_warning" {
+ type = bool
+ default = false
+ description = "Enable warning"
+}
diff --git a/tests/components/terraform/foobar/versions.tf b/tests/components/terraform/foobar/versions.tf
new file mode 100644
index 00000000..5a075c0e
--- /dev/null
+++ b/tests/components/terraform/foobar/versions.tf
@@ -0,0 +1,8 @@
+terraform {
+ required_providers {
+ validation = {
+ source = "tlkamp/validation"
+ version = "1.1.1"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/stacks/catalog/foobar-changes.yaml b/tests/stacks/catalog/foobar-changes.yaml
index 48bebbdc..edd54679 100644
--- a/tests/stacks/catalog/foobar-changes.yaml
+++ b/tests/stacks/catalog/foobar-changes.yaml
@@ -9,3 +9,4 @@ components:
example: blue
enabled: true
enable_failure: false
+ enable_warning: true