diff --git a/resources/environments/polling.go b/resources/environments/polling.go index 9778257f..6847dfb1 100644 --- a/resources/environments/polling.go +++ b/resources/environments/polling.go @@ -38,23 +38,26 @@ func waitForEnvironmentToBeDeleted(environmentName string, fallbackTimeout time. return err } stateConf := &retry.StateChangeConf{ - Pending: []string{"STORAGE_CONSUMPTION_COLLECTION_UNSCHEDULING_IN_PROGRESS", - "NETWORK_DELETE_IN_PROGRESS", - "FREEIPA_DELETE_IN_PROGRESS", - "RDBMS_DELETE_IN_PROGRESS", - "IDBROKER_MAPPINGS_DELETE_IN_PROGRESS", - "S3GUARD_TABLE_DELETE_IN_PROGRESS", - "CLUSTER_DEFINITION_DELETE_PROGRESS", + Pending: []string{ "CLUSTER_DEFINITION_CLEANUP_PROGRESS", - "UMS_RESOURCE_DELETE_IN_PROGRESS", - "DELETE_INITIATED", + "CLUSTER_DEFINITION_DELETE_PROGRESS", + "COMPUTE_CLUSTERS_DELETE_IN_PROGRESS", "DATAHUB_CLUSTERS_DELETE_IN_PROGRESS", "DATALAKE_CLUSTERS_DELETE_IN_PROGRESS", - "PUBLICKEY_DELETE_IN_PROGRESS", + "DELETE_INITIATED", + "ENVIRONMENT_ENCRYPTION_RESOURCES_DELETED", + "ENVIRONMENT_RESOURCE_ENCRYPTION_DELETE_IN_PROGRESS", "EVENT_CLEANUP_IN_PROGRESS", "EXPERIENCE_DELETE_IN_PROGRESS", - "ENVIRONMENT_RESOURCE_ENCRYPTION_DELETE_IN_PROGRESS", - "ENVIRONMENT_ENCRYPTION_RESOURCES_DELETED"}, + "FREEIPA_DELETE_IN_PROGRESS", + "IDBROKER_MAPPINGS_DELETE_IN_PROGRESS", + "NETWORK_DELETE_IN_PROGRESS", + "PUBLICKEY_DELETE_IN_PROGRESS", + "RDBMS_DELETE_IN_PROGRESS", + "S3GUARD_TABLE_DELETE_IN_PROGRESS", + "STORAGE_CONSUMPTION_COLLECTION_UNSCHEDULING_IN_PROGRESS", + "UMS_RESOURCE_DELETE_IN_PROGRESS", + }, Target: []string{}, Delay: 5 * time.Second, Timeout: *timeout, diff --git a/resources/environments/resource_aws_environment.go b/resources/environments/resource_aws_environment.go index 5e476f08..c2ef1775 100644 --- a/resources/environments/resource_aws_environment.go +++ b/resources/environments/resource_aws_environment.go @@ -133,7 +133,11 @@ func (r *awsEnvironmentResource) Delete(ctx context.Context, req resource.Delete if resp.Diagnostics.HasError() { return } - if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), state.Cascading.ValueBool(), ctx, r.client, resp, state.PollingOptions); err != nil { + cascading := state.Cascading.ValueBool() + if state.Cascading.IsNull() { + cascading = true + } + if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), cascading, ctx, r.client, resp, state.PollingOptions); err != nil { return } } diff --git a/resources/environments/resource_azure_environment.go b/resources/environments/resource_azure_environment.go index b7367c0e..74f2f95d 100644 --- a/resources/environments/resource_azure_environment.go +++ b/resources/environments/resource_azure_environment.go @@ -242,7 +242,11 @@ func (r *azureEnvironmentResource) Delete(ctx context.Context, req resource.Dele return } - if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), state.Cascading.ValueBool(), ctx, r.client, resp, state.PollingOptions); err != nil { + cascading := state.Cascading.ValueBool() + if state.Cascading.IsNull() { + cascading = true + } + if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), cascading, ctx, r.client, resp, state.PollingOptions); err != nil { return } } diff --git a/resources/environments/resource_gcp_environment.go b/resources/environments/resource_gcp_environment.go index 2f9f303c..0466d975 100644 --- a/resources/environments/resource_gcp_environment.go +++ b/resources/environments/resource_gcp_environment.go @@ -129,7 +129,11 @@ func (r *gcpEnvironmentResource) Delete(ctx context.Context, req resource.Delete return } - if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), state.Cascading.ValueBool(), ctx, r.client, resp, state.PollingOptions); err != nil { + cascading := state.Cascading.ValueBool() + if state.Cascading.IsNull() { + cascading = true + } + if err := deleteEnvironmentWithDiagnosticHandle(state.EnvironmentName.ValueString(), cascading, ctx, r.client, resp, state.PollingOptions); err != nil { return } }