Skip to content

Commit

Permalink
Make infra service test cleanup more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenyu committed Dec 19, 2023
1 parent 628dfc3 commit 99aa5b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions infra/test/infra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/terratest/modules/shell"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/require"
)

var uniqueId = strings.ToLower(random.UniqueId())
Expand Down Expand Up @@ -136,6 +137,14 @@ func EnableDestroyService(t *testing.T, terraformOptions *terraform.Options) {
},
WorkingDir: "../../",
})

// Clone the options and set targets to only apply to the buckets
terraformOptions, err := terraformOptions.Clone()
require.NoError(t, err)
terraformOptions.Targets = []string{
"module.service.aws_s3_bucket.access_logs",
"module.storage.aws_s3_bucket.storage",
}
terraform.Apply(t, terraformOptions)
fmt.Println("::endgroup::")
}
Expand Down

0 comments on commit 99aa5b6

Please sign in to comment.