Skip to content

fix(infra): delegate Container Apps subnet + stop masking failed terraform apply (PROD RECOVERY)#430

Merged
james-tn merged 1 commit into
mainfrom
fix/aca-subnet-delegation
Jun 9, 2026
Merged

fix(infra): delegate Container Apps subnet + stop masking failed terraform apply (PROD RECOVERY)#430
james-tn merged 1 commit into
mainfrom
fix/aca-subnet-delegation

Conversation

@james-tn

@james-tn james-tn commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

PRODUCTION RECOVERY for the outage caused by the #429 private-topology redeploy.

Root causes

  1. The container_apps subnet lacked the required delegation, so the VNet-integrated Container Apps environment failed to create (ManagedEnvironmentSubnetDelegationError). The old env had already been destroyed -> no env, no apps.
  2. The deploy step ran terraform apply | tee inside an if-condition without pipefail, so a failed apply reported success (tee's exit code) and masked the failure.

Fixes

  • Add Microsoft.App/environments delegation to the container_apps subnet (network.tf).
  • Capture terraform's real exit code via PIPESTATUS so a failed apply fails the job (infrastructure.yml).

Merging triggers a production redeploy that recreates the environment + apps with the corrected subnet delegation.

…aform apply

PRODUCTION RECOVERY.

Two bugs combined to take down the production Container Apps environment during
the private-topology redeploy (#429):

1. The container_apps subnet had no delegation, so creating the VNet-integrated
   Container Apps environment failed with:
     ManagedEnvironmentSubnetDelegationError: The subnet of the environment must
     be delegated to the service 'Microsoft.App/environments'.
   Add the required delegation (Microsoft.App/environments +
   Microsoft.Network/virtualNetworks/subnets/join/action).

2. The deploy step ran 'terraform apply ... | tee' inside an if-condition with no
   pipefail, so the pipeline reported tee's (success) exit status and MASKED the
   failed apply. The old environment had already been destroyed, so the job went
   green while production was left with no environment and no container apps.
   Capture terraform's real exit code via PIPESTATUS so a failed apply fails the
   job instead of silently reporting success.

With the delegation in place the environment can be (re)created, and the
PIPESTATUS fix ensures any future apply failure surfaces instead of corrupting
the environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@james-tn james-tn merged commit 9134cfb into main Jun 9, 2026
5 checks passed
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