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

Add ability to force delete pingone_population resources if it contains users #234

Closed
patrickcping opened this issue Jan 19, 2023 · 1 comment · Fixed by #773
Closed
Assignees
Labels
service/base PingOne Platform service/sso PingOne SSO size/medium Medium size change (e.g. enhancing the logic of an existing resource or datasource) type/enhancement/ux Enhancements specifically for user experience of the provider
Milestone

Comments

@patrickcping
Copy link
Collaborator

patrickcping commented Jan 19, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

When running a destroy on an environment with user data in it, or removing a population that contains users (in both cases the users must be created naturally and not through the pingone_user resource), the current behaviour is that removal of the population will be blocked by the PingOne platform until all users are removed first.

While this is good protection for environments of the "production" type, it adds additional manual overhead when spinning up development/testing environments that are of type "sandbox".

The enhancement is to, under specific conditions, be able to override the platform's restriction and automatically empty the populations of users allowing the destroy to take place successfully.

Proposed conditions are (both numbered conditions must be met):

  1. Environment level protection. One of the following bullet points must be met:
  • The environment is of type SANDBOX. Usage on a PRODUCTION environment with the force_delete_production_type provider parameter set to false requires the HCL writer to first downgrade the environment to SANDBOX and then re-attempt.
  • The environment is of type PRODUCTION and the force_delete_production_type provider parameter is set to true.
  1. A parameter prevent_destroy_with_data is added to the pingone_population resource (and the pingone_environment resource for the default population) and the HCL writer explicitly sets this value to false. The default value would be true.

New or Affected Resource(s)

  • pingone_population
  • pingone_population_default

Potential Terraform Configuration

SANDBOX type:

provider "pingone" {
  # ... other options

  force_delete_production_type = false
}

resource "pingone_population" "my_population" {
  environment_id = pingone_environment.my_environment.id

  name        = "My second population"
  description = "My new population"

  prevent_destroy_with_data = false
}

PRODUCTION type:

provider "pingone" {
  # ... other options

  force_delete_production_type = true
}

resource "pingone_population" "my_population" {
  environment_id = pingone_environment.my_environment.id

  name        = "My second population"
  description = "My new population"

  prevent_destroy_with_data = false
}

References

@patrickcping patrickcping added type/enhancement New feature or request service/base PingOne Platform service/sso PingOne SSO labels Jan 19, 2023
@patrickcping patrickcping added this to the v0.15.0 milestone Mar 17, 2023
@patrickcping patrickcping added type/enhancement/ux Enhancements specifically for user experience of the provider and removed type/enhancement New feature or request labels Apr 18, 2023
@patrickcping patrickcping modified the milestones: v0.15.0, v0.16.0 Apr 24, 2023
@patrickcping patrickcping modified the milestones: v0.16.0, v0.17.0 May 11, 2023
@patrickcping patrickcping added the size/medium Medium size change (e.g. enhancing the logic of an existing resource or datasource) label May 22, 2023
@patrickcping patrickcping modified the milestones: v0.17.0, v0.18.0 Jun 20, 2023
@patrickcping patrickcping modified the milestones: v0.18.0, v0.19.0 Jul 13, 2023
@mjspi
Copy link
Contributor

mjspi commented Jul 20, 2023

Upvote to the approach with one minor consideration. Instead of the double-negative on the population parameter to allow a population w/users to be deleted (prevent_destroy_with_data = false) , my lean is to follow similar naming as the environment-level parameter force_delete_production_type.

Perhaps consider a modification to require the HCL writer to explicitly state that deleting a population with users is permitted: force_destroy_with_data = true. ("As an HCL writer, I am allowing a population with user data to be deleted.")

@patrickcping patrickcping modified the milestones: v0.19.0, v0.20.0 Aug 3, 2023
@patrickcping patrickcping modified the milestones: v0.20.0, v0.21.0 Aug 17, 2023
@patrickcping patrickcping self-assigned this Sep 12, 2023
@patrickcping patrickcping modified the milestones: v0.21.0, v0.22.0 Sep 15, 2023
@patrickcping patrickcping modified the milestones: v0.22.0, v0.23.0 Oct 2, 2023
@patrickcping patrickcping modified the milestones: v0.23.0, v0.24.0 Nov 3, 2023
@patrickcping patrickcping removed this from the v0.24.0 milestone Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/base PingOne Platform service/sso PingOne SSO size/medium Medium size change (e.g. enhancing the logic of an existing resource or datasource) type/enhancement/ux Enhancements specifically for user experience of the provider
Projects
None yet
2 participants