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

feat: minimal resource states when creating and when read while deleting #158

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

ligfx
Copy link
Contributor

@ligfx ligfx commented Oct 3, 2024

  • Don't wait for clusters to be in a ready state before deleting them. The Cloud API will accept a delete operation regardless of the current cluster state. This allows users to delete a partially-created cluster without having to wait for it to fully come up.

  • When creating Clusters, Serverless Clusters, and Networks, store their id in the Terraform state as soon as we have it. This way, if creation fails for any reason, Terraform knows that we have a tainted resource and it can be deleted, manually untainted, etc., and Terraform won't try to recreate it (which usually fails since the name is taken).

  • When reading Clusters, Serverless Clusters, and Networks, if the resource is in the process of being deleted, null out most of their Terraform state aside from their id, so that Terraform knows they can't be used anymore and needs to destroy (i.e. wait for them to finish deleting) and recreate them to match the plan.

ligfx added 2 commits October 3, 2024 15:53
Changes Clusters, Serverless Clusters, and Networks to:

- When creating, store their id in the Terraform state as soon as we
  have it. This way, if creation fails for any reason, Terraform knows
  that we have a tainted resource and it can be deleted, manually
  untainted, etc., and Terraform won't try to recreate it (which usually
  fails since the name is taken).

- When reading, if the resource is in the process of being deleted,
  null out most of their Terraform state _aside from_ their id, so
  that Terraform knows they can't be used anymore and needs to destroy
  (i.e. wait for them to finish deleting) and recreate them to match
  the plan.
The Cloud API will accept a delete operation regardless of the current
cluster state. This allows users to delete a partially-created cluster
without having to wait for it to fully come up.
@ligfx
Copy link
Contributor Author

ligfx commented Oct 3, 2024

@gene-redpanda I noticed some of the recent tests are timing out on cluster creation, and then failing to clean up resources because Terraform doesn't know the clusters exist.

I pulled this out of the BYOC work, this should help Terraform recover and delete the clusters and then rest of the resources correctly.

@ligfx ligfx added the ci-ready label Oct 3, 2024
Copy link
Contributor

@gene-redpanda gene-redpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will merge in after tests pass

@ligfx ligfx mentioned this pull request Oct 4, 2024
@gene-redpanda gene-redpanda merged commit 8444134 into redpanda-data:main Oct 4, 2024
11 checks passed
@ligfx ligfx deleted the minimal_state branch October 4, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants