diff --git a/Makefile b/Makefile index f6bf013..7445067 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ testacc: TF_ACC=1 go test `go list ./internal/... | grep -v -e promotion` -timeout 10m -v -p 4 testaccpromotion: - TF_ACC=1 go test `go list ./internal/... | grep -e promotion` -timeout 30m -v -p 4 + TF_ACC=1 TF_LOG=warn go test `go list ./internal/... | grep -e promotion` -timeout 55m -v -p 4 testaccfolder: TF_ACC=1 go test ./internal/resource/${ACC_TEST_FOLDER}... -timeout 10m -v -count=1 diff --git a/internal/resource/promotion/promotion_lock_resource_gen.go b/internal/resource/promotion/promotion_lock_resource_gen.go index 6150916..bed179f 100644 --- a/internal/resource/promotion/promotion_lock_resource_gen.go +++ b/internal/resource/promotion/promotion_lock_resource_gen.go @@ -4,6 +4,7 @@ package promotion import ( "context" + "io" "net/http" "time" @@ -13,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" client "github.com/pingidentity/identitycloud-go-client/identitycloud" "github.com/pingidentity/terraform-provider-identitycloud/internal/auth" "github.com/pingidentity/terraform-provider-identitycloud/internal/providererror" @@ -225,6 +227,13 @@ func (r *promotionLockResource) Create(ctx context.Context, req resource.CreateR finalErr := retry.Do(ctx, retries, func(ctx context.Context) error { _, httpResp, err = r.apiClient.PromotionAPI.LockExecute(apiCreateRequest) if err != nil && httpResp != nil && httpResp.StatusCode == 409 { + defer httpResp.Body.Close() + body, bodyErr := io.ReadAll(httpResp.Body) + if bodyErr == nil { + tflog.Warn(ctx, "Environment lock failure, retryable error: "+err.Error()+", body: "+string(body)) + } else { + tflog.Warn(ctx, "Environment lock failure, retryable error: "+err.Error()) + } return retry.RetryableError(err) } return err @@ -312,6 +321,13 @@ func (r *promotionLockResource) Delete(ctx context.Context, req resource.DeleteR finalErr := retry.Do(ctx, retries, func(ctx context.Context) error { _, httpResp, err = r.apiClient.PromotionAPI.Unlock(auth.AuthContext(ctx, r.accessToken, r.serviceAccountTokenSource), data.PromotionId.ValueString()).AcceptAPIVersion("protocol=1.0,resource=1.0").Execute() if err != nil && httpResp != nil && httpResp.StatusCode == 409 { + defer httpResp.Body.Close() + body, bodyErr := io.ReadAll(httpResp.Body) + if bodyErr == nil { + tflog.Warn(ctx, "Environment unlock failure, retryable error: "+err.Error()+", body: "+string(body)) + } else { + tflog.Warn(ctx, "Environment unlock failure, retryable error: "+err.Error()) + } return retry.RetryableError(err) } return err diff --git a/internal/resource/promotion/promotion_lock_resource_gen_test.go b/internal/resource/promotion/promotion_lock_resource_gen_test.go index f54eec2..4d44a35 100644 --- a/internal/resource/promotion/promotion_lock_resource_gen_test.go +++ b/internal/resource/promotion/promotion_lock_resource_gen_test.go @@ -52,8 +52,8 @@ func promotionLock_MinimalHCL(includeDataSource bool) string { result := ` resource "identitycloud_promotion_lock" "example" { retry_timeouts = { - create = "30m" - delete = "30m" + create = "50m" + delete = "50m" } }