From b85d48e2c829885285338207c0c25894b230b843 Mon Sep 17 00:00:00 2001 From: Matt White <16320656+matt-FFFFFF@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:29:27 +0000 Subject: [PATCH] fix!: incorrect logic around applyidempotant (#77) * fix: incorrect logic around applyidempotant * chore: oh linting I love you * test: update test --- setuptest/apply.go | 4 ++-- setuptest/testdata/applyidempotentretryfail/main.tf | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/setuptest/apply.go b/setuptest/apply.go index f08072d..1bbd72b 100644 --- a/setuptest/apply.go +++ b/setuptest/apply.go @@ -93,9 +93,9 @@ func (resp Response) ApplyIdempotentRetry(r Retry) *testerror.Error { case 0: return "", nil case 2: - return "", errors.New("terraform configuration not idempotent") + return "", retry.FatalError{Underlying: errors.New("terraform configuration not idempotent")} default: - return "", retry.FatalError{Underlying: errors.New("terraform plan exit code 1 or other error")} + return "", errors.New("terraform plan error") } }) diff --git a/setuptest/testdata/applyidempotentretryfail/main.tf b/setuptest/testdata/applyidempotentretryfail/main.tf index 79cf9e4..d34a378 100644 --- a/setuptest/testdata/applyidempotentretryfail/main.tf +++ b/setuptest/testdata/applyidempotentretryfail/main.tf @@ -2,15 +2,15 @@ terraform { required_version = ">= 1.4.0" required_providers { local = { - source = "hashicorp/local" + source = "hashicorp/local" version = ">= 2.4.0" } } } resource "local_file" "test" { - content = "test" - filename = "test.txt" + content = "test" + filename = "test.txt" file_permission = "0644" } @@ -22,8 +22,8 @@ resource "terraform_data" "test" { } provisioner "local-exec" { - command = "rm -f test.txt" - when = create + command = "rm -rf .terraform" + when = create } depends_on = [ local_file.test,