cloudfoundry-community / terraform-provider-cloudfoundry

Terraform Cloud Foundry Provider
https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest
Mozilla Public License 2.0
73 stars 86 forks source link

Add ability to disable recursive deletion on orgs and spaces #529

Closed clementdqn closed 7 months ago

clementdqn commented 1 year ago

To prevent users from deleting their orgs or spaces that still contain resources, we want to add this feature in the provider.

Here are two solutions to add this feature :

  1. First solution, we add the possibility to disable recursive deletion of organizations or spaces thanks to two separated variables AllowRecursiveOrgDeletion and AllowRecursiveSpaceDeletion. Set to false it disables recursive deletion by checking if the concerned resource still has children and returns an error. See PR #527

  2. Second solution, we add the possibility to disable recursive deletion of resources with one variable delete_recursive_allowed. Set to false it disables recursive deletion by checking if the concerned organization or space still has children and returns an error. See PR #528

For the two solutions above, recursive deletion is enabled by default so it won't change the way the plugin works now.

The first solution is our preference because we can choose to enable or disable recursive deletion on specific resources only.

Both solutions were tested on our platform and i updated the delete function for org and space to use the API V3.

clementdqn commented 7 months ago

Issue completed as #528 is Merged