Skip to content

fix: check if catalog type is editable before deletion#285

Open
maxtacu wants to merge 3 commits intoincident-io:masterfrom
maxtacu:fix/catalog-type-editable
Open

fix: check if catalog type is editable before deletion#285
maxtacu wants to merge 3 commits intoincident-io:masterfrom
maxtacu:fix/catalog-type-editable

Conversation

@maxtacu
Copy link
Contributor

@maxtacu maxtacu commented Nov 22, 2025

small context

We let people manage schedules directly in incident.io, but want governance over naming and enforce conventions. We achieve this by initializing empty schedules via Terraform using the incident_schedule resource, with lifecycle rules to ignore changes except the name. This lets people init schedules through Git and approval, then edit them in incident.io. We also set a custom boolean catalog entry attribute to mark if a schedule is paid, managed in the incident_catalog_entry resource.

problem statement:

When destroying a schedule in Terraform, the provider tries to delete the linked catalog entry first. But for externally synced catalog types (like the built-in "Schedule" type), this fails because they can't be edited. Since incident.io automatically removes entries from synced types when the source is deleted, Terraform shouldn't try to delete them.

how it works

  1. Before attempting to delete a catalog entry, the method fetches the catalog type details.
  2. It checks the IsEditable field of the catalog type.
  3. If the catalog type is not editable (indicating it's externally synced), the deletion is skipped entirely.
  4. For editable catalog types, the deletion proceeds as before.

This ensures that catalog entries for externally synced types (like the built-in "Schedule" type) are not deleted by Terraform, preventing the "Externally synced catalog types can't be edited" error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant