Skip to content

feat(infra): manage sluice.phoenixvc.tech custom domain in Terraform#129

Merged
JustAGhosT merged 1 commit into
devfrom
feat/custom-domain-terraform
Jul 3, 2026
Merged

feat(infra): manage sluice.phoenixvc.tech custom domain in Terraform#129
JustAGhosT merged 1 commit into
devfrom
feat/custom-domain-terraform

Conversation

@JustAGhosT

@JustAGhosT JustAGhosT commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What

Backports the out-of-band sluice.phoenixvc.tech custom-domain binding on Container App pvc-prod-sluice-ca (RG pvc-prod-sluice-rg) into Terraform, so the next apply adopts it instead of flagging or undoing it as drift.

Background — what was created out-of-band

On 2026-07-03 the hostname was bound manually:

  • az containerapp hostname add + az containerapp hostname bind --validation-method CNAME
  • Azure-managed certificate: mc-pvc-prod-sluic-sluice-phoenixvc-1673
  • Verified live: HTTPS 200 on https://sluice.phoenixvc.tech/health/liveliness

Changes

File Change
infra/modules/sluice_aca/variables.tf New custom_domains (list(string), default [])
infra/modules/sluice_aca/main.tf New azurerm_container_app_custom_domain.custom (for_each)
infra/modules/sluice_aca/outputs.tf New custom_domain_fqdns output
infra/env/prod/variables.tf Pass-through custom_domains variable
infra/env/prod/main.tf Wire variable into module "sluice" + import {} block
infra/env/prod/terraform.tfvars custom_domains = ["sluice.phoenixvc.tech"]

Import block — adoption semantics

The import {} block in infra/env/prod/main.tf adopts the existing live binding on the next apply. Expected plan for this resource: 1 to import, 0 to add, 0 to change, 0 to destroy. Once the binding is in state the block is a no-op and can be removed in a follow-up.

Import ID (note containerApps capital A — the azurerm v4 ID parser is case-sensitive on static segments and rejects the all-lowercase form that az containerapp show --query id returns; casing verified against the format string embedded in the azurerm v4.70.0 provider binary):

/subscriptions/bb4e3882-2079-4bab-8974-611bc0b8bb58/resourceGroups/pvc-prod-sluice-rg/providers/Microsoft.App/containerApps/pvc-prod-sluice-ca/customDomainName/sluice.phoenixvc.tech

Managed-cert ignore_changes rationale

The certificate is an Azure-managed cert provisioned by az containerapp hostname bind — the azurerm provider cannot manage managed certificates on this resource directly. Per the provider docs, certificate_binding_type and container_app_environment_certificate_id must be in lifecycle.ignore_changes, otherwise every plan tries to unbind the certificate.

DNS intentionally out of scope

The CNAME and asuid.sluice TXT records live in the org-owned phoenixvc.tech zone in mys-global-shared-rg — a different subscription/ownership boundary than sluice. DNS stays out of this stack; this is documented in a code comment on the resource.

Validation

  • terraform fmt -recursive — clean, no reformats
  • terraform init -backend=false + terraform validate in infra/env/prodSuccess! The configuration is valid. (azurerm v4.70.0, random v3.8.1)
  • No plan/apply was run against real state from this branch — CI/the operator apply path remains authoritative

Baton task: 5dc28591

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for custom domains in the production deployment, allowing the app to be accessed via preconfigured hostnames.
    • Existing custom domain bindings can now be brought under Terraform management without replacing them.
    • Exposed the list of configured custom domain names as an output for visibility.
  • Chores

    • Updated production configuration to enable a custom domain for the live environment.

Backport the out-of-band custom-domain binding (created 2026-07-03 via
az containerapp hostname add + hostname bind) into the sluice_aca module
so subsequent applies adopt it instead of flagging drift.

- sluice_aca module: new custom_domains variable +
  azurerm_container_app_custom_domain resource with ignore_changes on
  the managed-cert attributes (azurerm cannot manage managed certs)
- env/prod: pass-through variable, tfvars entry, and an import block
  adopting the live binding (expect 1 to import, 0 to add/change/destroy)
- DNS (CNAME + asuid TXT) stays in the org-owned phoenixvc.tech zone in
  mys-global-shared-rg (different subscription) — intentionally out of
  scope here

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 3, 2026 01:34
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 079e933d-e733-409a-a4f3-1e40ffd17237

📥 Commits

Reviewing files that changed from the base of the PR and between 18a5b02 and 60fd594.

📒 Files selected for processing (6)
  • infra/env/prod/main.tf
  • infra/env/prod/terraform.tfvars
  • infra/env/prod/variables.tf
  • infra/modules/sluice_aca/main.tf
  • infra/modules/sluice_aca/outputs.tf
  • infra/modules/sluice_aca/variables.tf

📝 Walkthrough

Walkthrough

Adds a custom_domains input variable and an azurerm_container_app_custom_domain resource plus a custom_domain_fqdns output to the sluice_aca Terraform module. The prod environment defines and wires custom_domains, sets sluice.phoenixvc.tech in tfvars, and imports the existing out-of-band binding into module state.

Changes

Custom Domain Support

Layer / File(s) Summary
Module custom domain variable, resource, and output
infra/modules/sluice_aca/variables.tf, infra/modules/sluice_aca/main.tf, infra/modules/sluice_aca/outputs.tf
Adds custom_domains list(string) variable, an azurerm_container_app_custom_domain resource iterating over it with lifecycle ignore rules for certificate binding, and a custom_domain_fqdns output.
Prod environment wiring, tfvars, and import
infra/env/prod/variables.tf, infra/env/prod/terraform.tfvars, infra/env/prod/main.tf
Declares custom_domains defaulting to empty list, sets it to ["sluice.phoenixvc.tech"] in tfvars, passes it into the sluice module, and adds an import block adopting the existing custom-domain binding into module-managed state.

Estimated code review effort: 2 (Simple) | ~15 minutes

Related PRs: None identified.

Suggested labels: infra, terraform

Suggested reviewers: None identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the infra change to manage the sluice.phoenixvc.tech custom domain in Terraform.
Description check ✅ Passed The description covers summary, background, changes, import semantics, validation, and deployment notes, with only risk/rollback left implicit.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/custom-domain-terraform

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR backports the existing (manually created) sluice.phoenixvc.tech custom-domain binding on the prod Azure Container App into Terraform, so future applies adopt the binding instead of treating it as drift.

Changes:

  • Adds a custom_domains input to the sluice_aca module and wires it through infra/env/prod.
  • Manages custom-domain bindings via azurerm_container_app_custom_domain with ignore_changes for managed-cert fields.
  • Adds a one-time import {} block in prod to adopt the existing binding into state.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
infra/modules/sluice_aca/variables.tf Adds custom_domains module input for pre-verified hostnames.
infra/modules/sluice_aca/main.tf Creates per-domain azurerm_container_app_custom_domain resources with lifecycle ignores for managed cert fields.
infra/modules/sluice_aca/outputs.tf Exposes the configured/bound custom domains from the module.
infra/env/prod/variables.tf Adds custom_domains variable to prod environment.
infra/env/prod/main.tf Passes custom_domains to the module and imports the existing prod binding into state.
infra/env/prod/terraform.tfvars Configures custom_domains = ["sluice.phoenixvc.tech"] for prod.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +322 to +326
variable "custom_domains" {
type = list(string)
description = "Pre-verified custom hostnames to bind to the gateway Container App. Each hostname must already have DNS in place (CNAME + asuid TXT in the owning zone) and an Azure-managed certificate provisioned out-of-band via `az containerapp hostname add` + `az containerapp hostname bind` before being listed here."
default = []
}
Comment on lines +1039 to +1041
lifecycle {
ignore_changes = [certificate_binding_type, container_app_environment_certificate_id]
}

output "custom_domain_fqdns" {
description = "Custom hostnames bound to the gateway Container App (empty when none configured)."
value = [for d in azurerm_container_app_custom_domain.custom : d.name]
@JustAGhosT JustAGhosT merged commit 39faa42 into dev Jul 3, 2026
2 checks passed
JustAGhosT added a commit that referenced this pull request Jul 3, 2026
…phoenixvc.tech (#130)

Lane partition ratified 2026-07-03: Codex owns release/prod, Claude owns
backend/security/infra. Merge authority follows the lane owner; cross-lane
coordination via PR comments.

Consumer base-URL examples now use the custom domain bound in PR #129 —
the raw azurecontainerapps.io FQDN still works but changes if the CAE is
rebuilt.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants