common-fate / terraform-provider-commonfate

The Common Fate Terraform Provider
MIT License
2 stars 2 forks source link

Display error indicating that availability may have been deleted when updating a non existent availability #106

Closed ckluy31 closed 3 months ago

ckluy31 commented 3 months ago

Initially tried to fulfill this requirement of the ticket:

Ideally, if we get a 404 error we should just recreate the availability and save the new ID in the state.

However, understandably ran into :

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to commonfate_auth0_organization_availabilities.auth0, provider "provider[\"registry.terraform.io/common-fate/commonfate\"]" produced
│ an unexpected new value: .id: was cty.StringVal("avspec_2jj7XNb87FSBLQfVbhesGE1RzwH"), but now cty.StringVal("avspec_2jj7tnQP6dNZjoFMsUvhHmELm2c").

Therefore, opting to change the error message instead.

Reproducing the error now gives:

│ Error: Auth0 Organization Availability Not Found
│ 
│   with commonfate_auth0_organization_availabilities.auth0,
│   on main.tf line 278, in resource "commonfate_auth0_organization_availabilities" "auth0":
│  278: resource "commonfate_auth0_organization_availabilities" "auth0" {
│ 
│ The requested Auth0 Organization Availability no longer exists. It may have been deleted or otherwise removed.
│ Please create a new Availability.
changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 6638c8cdb3900bff58669a703e9786c2de589765

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------------------------ | ----- | | @common-fate/terraform-provider-commonfate | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR