Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-27671 Updated environment deletion states, handled null cascading delete option #174

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions resources/environments/polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion resources/environments/resource_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
6 changes: 5 additions & 1 deletion resources/environments/resource_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
6 changes: 5 additions & 1 deletion resources/environments/resource_gcp_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Loading