Skip to content

Commit

Permalink
Implement a custom backend
Browse files Browse the repository at this point in the history
  • Loading branch information
romanini-ciandt committed Nov 8, 2024
1 parent 693ac7c commit 1b19ca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/monitoring_alerts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* If multiple key versions are deleted in less than 5 minutes a single notification will be sent.
*/

terraform {
backend "local" {}
}

resource "random_string" "suffix" {
length = 4
special = false
Expand Down
9 changes: 8 additions & 1 deletion test/integration/monitoring_alerts/monitoring_alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package monitoring_alert
import (
"errors"
"fmt"
"os"
"strings"
"testing"
"time"
Expand All @@ -28,21 +29,27 @@ import (
)

func TestMonitoringAlertKeyVersion(t *testing.T) {
path, _ := os.Getwd()

emailAddresses := []string{"[email protected]", "[email protected]"}

for _, monitor_all_keys_in_the_project := range []bool{
for index, monitor_all_keys_in_the_project := range []bool{
true,
false,
} {

statePath := fmt.Sprintf("%s/custom_backend_%d.tfstate", path, index)

vars := map[string]interface{}{
"monitor_all_keys_in_the_project": monitor_all_keys_in_the_project,
"email_addresses_to_be_notified": emailAddresses,
}

kmsAlertT := tft.NewTFBlueprintTest(t,
tft.WithVars(vars),
tft.WithBackendConfig(map[string]interface{}{
"path": statePath,
}),
)

kmsAlertT.DefineVerify(func(assert *assert.Assertions) {
Expand Down

0 comments on commit 1b19ca7

Please sign in to comment.