feat: Add delete protection support for ROSA HCP clusters#1034
feat: Add delete protection support for ROSA HCP clusters#1034paulczar wants to merge 1 commit intoterraform-redhat:mainfrom
Conversation
Add delete_protection attribute to rhcs_cluster_rosa_hcp resource to
prevent accidental cluster deletion. This feature enables users to
protect production clusters through Terraform, matching the functionality
available in the ROSA CLI.
Changes:
- Add delete_protection boolean attribute to ClusterRosaHcpState
- Enable delete protection during cluster creation when set to true
- Read delete protection status from OCM API in Read operation
- Update delete protection status via Terraform Update operation
- Automatically disable delete protection before cluster deletion
- Add unit tests for delete protection state handling
- Add subsystem tests for full CRUD flow with mocked API handlers
The implementation uses the OCM API endpoint
/api/clusters_mgmt/v1/clusters/{cluster_id}/delete_protection to manage
delete protection status. When delete protection fails to enable during
creation, a warning is logged but cluster creation succeeds, and the
state value is preserved to avoid Terraform inconsistency errors.
Signed-off-by: Paul Czarkowski <username.taken@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @paulczar. Thanks for your PR. I'm waiting for a terraform-redhat member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
@paulczar: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
Adds delete protection support for ROSA HCP clusters, enabling users to prevent accidental cluster deletion through Terraform. This feature matches the ROSA CLI functionality and enables full infrastructure-as-code workflows.
Changes:
delete_protectionattribute torhcs_cluster_rosa_hcpresourceWhich issue(s) this PR fixes:
Fixes #1033
Change type