Skip to content

Stop Terraform apply from rolling back just deploy-dev images - #86

Merged
NinjaLikesCheez merged 3 commits into
mainfrom
cursor/container-image-drift-c79d
Oct 11, 2026
Merged

NinjaLikesCheez merged 3 commits into
mainfrom
cursor/container-image-drift-c79d

Conversation

@NinjaLikesCheez

@NinjaLikesCheez NinjaLikesCheez commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #73.

just deploy-dev pins Azure dev to a GHCR SHA via az containerapp update. Terraform still had container_image on the Container App, so a later just tf-apply dev with a stale gitignored tfvars SHA could roll the bot backward.

Chosen approach: Terraform lifecycle.ignore_changes on the dev Pixel container image only (azurerm_container_app.this). Apply still manages vault, volume, env and the replica pin. After first create, just deploy-dev / az owns the running dev image.

Prod is not ignored. Terraform cannot condition ignore_changes, so #12 uses a second resource (azurerm_container_app.managed) with no image ignore. Prod apply will set container_image. A moved block keeps live pixel-dev as this[0] (address change only; not a replace).

Not in this PR: no prod apply, no second running app, replica count stays min = max = 1, CD still does not apply Terraform.

Docs

  • Runbook Azure + Deploys: dev image is owned by just deploy-dev; first apply after merge moves this → this[0]
  • ADR 0009 / 0010: ignore is dev-only; prod apply sets the image
  • CHANGELOG.md Unreleased (Fixed)
  • Variable / example-tfvars comments and infra READMEs

This does not change core/access*, identity, dispatcher, registry, or access-config.

How to verify

just tf-validate
just check

With Azure login (does not apply):

az containerapp show -g pixel-dev -n pixel-dev --query "properties.template.containers[0].image" -o tsv
just tf-plan dev
# Plan must not propose changing the running image back.
# It may show a move: azurerm_container_app.this → this[0] (not destroy/create).

Leftover human steps

Open in Web Open in Cursor 

Ignore the Pixel container image after first create so just tf-apply
cannot replace the SHA just deploy-dev pinned. Document that az owns
the running pin; keep min=max replicas at 1.

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
Terraform cannot condition lifecycle, so prod (#12) gets a second
Container App resource that still sets container_image. Dev keeps the
ignore plus a moved block so pixel-dev is not replaced.

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
CI plan failed because concat of the Container App objects marked
the name output sensitive. Export local.name_prefix instead.

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
@NinjaLikesCheez
NinjaLikesCheez marked this pull request as ready for review October 11, 2026 09:44
@NinjaLikesCheez
NinjaLikesCheez merged commit 00c47e9 into main Oct 11, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
dev — 054ba9d9 Deployed Oct 11, 2026 by cursor[bot] via Plan envs/dev #32
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.

Stop Terraform apply from rolling back just deploy-dev images

2 participants