Skip to content

Commit 9095c9c

Browse files
rajbosCopilot
andcommitted
fix: prevent cert provisioning on per-branch testing deploys
Custom domain managed certificates are only meaningful on stable, long-lived environments (production). Each testing branch gets a unique ACA FQDN (sharing-test-<slug>.azurecontainerapps.io) that already has Azure TLS — no custom cert needed. Setting SHARING_CUSTOM_DOMAIN on the testing GitHub environment caused every new branch deploy to provision a fresh cert via CNAME validation, which takes up to 60 minutes and fails if the CNAME points to a different ACA environment (as it always does for per-branch deploys). Changes: - Gate the Reconcile custom domain workflow step on is_prod == 'true' so it is skipped for all non-main branch deploys even if SHARING_CUSTOM_DOMAIN is accidentally set on the testing environment - Add a comment to main.tf explaining the custom_domain var is production-only Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9f0653e commit 9095c9c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/sharing-server-deploy.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ jobs:
175175
-backend-config="key=${{ needs.setup.outputs.state_key }}"
176176
177177
- name: Reconcile custom domain Terraform state
178-
if: steps.prereqs.outputs.configured == 'true' && vars.SHARING_CUSTOM_DOMAIN != ''
178+
# Custom domains (and their managed certs) are only meaningful on stable, long-lived
179+
# environments (production). Per-branch testing environments each get a unique ACA FQDN
180+
# which already has Azure TLS — setting SHARING_CUSTOM_DOMAIN on the testing GitHub
181+
# environment will be ignored here to prevent 60-minute cert provisioning on every PR.
182+
if: steps.prereqs.outputs.configured == 'true' && vars.SHARING_CUSTOM_DOMAIN != '' && needs.setup.outputs.is_prod == 'true'
179183
working-directory: sharing-server/infra
180184
env:
181185
TF_VAR_resource_group_name: ${{ vars.AZURE_RESOURCE_GROUP }}

sharing-server/infra/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ resource "azurerm_container_app" "this" {
191191

192192
# ── Custom domain + managed TLS certificate ───────────────────────────────────
193193
# Only created when var.custom_domain is set.
194+
# Intended for stable, long-lived environments (production) only.
195+
# Per-branch testing environments should leave var.custom_domain empty — they use
196+
# the ACA-generated FQDN (*.azurecontainerapps.io) which already has Azure TLS.
197+
# Provisioning a managed cert requires CNAME validation and can take up to 60 min.
194198
# DNS prerequisites (must exist before applying):
195199
# CNAME <subdomain> → local.aca_fqdn
196200
# TXT asuid.<subdomain> → azurerm_container_app_environment.this.custom_domain_verification_id

0 commit comments

Comments
 (0)