You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: clean up portal-created cert/domain before TF apply instead of importing
The previous import approach caused a 400 'CertificateInUse' error because
Azure auto-generates cert names in the portal, which don't match the Terraform
resource name ('sharing-cert'). After import, TF detected the name drift and
planned a destroy+recreate, but Azure blocks cert deletion while a domain
binding exists.
New approach:
- Detect if TF state has a cert with a non-TF name (portal-created)
- If so: delete the domain binding first, then delete the cert, remove stale
TF state entries — letting Terraform create both resources fresh with the
correct names
- If cert is already TF-managed ('sharing-cert'): no-op
Also added lifecycle.create_before_destroy = true on the cert resource as a
safety net for future cert replacements.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments