Skip to content

Commit

Permalink
when execute destroy, try 5 times destroy with refresh, then 5 times …
Browse files Browse the repository at this point in the history
…without refresh
  • Loading branch information
lonegunmanb committed Jan 13, 2023
1 parent 98552d8 commit 85fb2fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions e2etest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ func RunE2ETest(t *testing.T, moduleRootPath, exampleRelativePath string, option
}

func destroy(t *testing.T, option terraform.Options) {
option.MaxRetries = 10
option.MaxRetries = 5
option.TimeBetweenRetries = time.Minute
option.RetryableTerraformErrors = map[string]string{
".*": "Retry destroy on any error",
}
_, err := terraform.RunTerraformCommandE(t, &option, terraform.FormatArgs(&option, "destroy", "-auto-approve", "-input=false", "-refresh=false")...)
_, err := terraform.DestroyE(t, &option)
if err != nil {
_, err = terraform.RunTerraformCommandE(t, &option, terraform.FormatArgs(&option, "destroy", "-auto-approve", "-input=false", "-refresh=false")...)
}
require.NoError(t, err)
}

Expand Down

0 comments on commit 85fb2fe

Please sign in to comment.