Skip to content

feat: use Azure Deployment Stacks for idempotent destroy (#30)#1

Open
arnaudlh wants to merge 1 commit into
mainfrom
feat/deployment-stacks-30
Open

feat: use Azure Deployment Stacks for idempotent destroy (#30)#1
arnaudlh wants to merge 1 commit into
mainfrom
feat/deployment-stacks-30

Conversation

@arnaudlh

Copy link
Copy Markdown
Owner

Replace plain subscription deployments (az deployment sub create) and RG-based destroy (az group delete) with Azure Deployment Stacks across all workflows and agent docs.

Why:
Plain sub-deployments + RG-delete leave orphans when a template spans
multiple RGs or creates sub-scope resources (role/policy assignments,
cross-scope role grants, remote-side refs). Stacks track every managed
resource across every scope as a single lifecycle unit, so destroy is
one idempotent call regardless of how templates evolve. See Azure#30.

Workflow changes:

  • git-ape-deploy: az stack sub validate/create with --action-on-unmanage deleteAll --deny-settings-mode none. Captures stackId and managedResources[] into state.json (schema v1.0).
  • git-ape-destroy: az stack sub show (inventory) + az stack sub delete --action-on-unmanage deleteAll --bypass-stack-out-of-sync-error. Removed old Build-destroy-plan / sub-resource-sweep / RG-delete steps. Missing-stack path now records already-destroyed (idempotent).
  • git-ape-plan: az stack sub validate for validation; keep az deployment sub what-if (stacks do not support what-if yet).

Docs:

  • copilot-instructions.md: updated deploy/destroy descriptions and inline bash example to stacks commands.
  • azure-resource-deployer.agent.md: deploy and rollback patterns use az stack sub create/delete.
  • azure-template-generator.agent.md: CLI and PowerShell examples use deployment stacks.
  • git-ape.agent.md: Stage 3 description references stacks.
  • DEPLOYMENT_STATE.md: documents state.json schema v1.0 with stackId and managedResources[] fields.

Replace plain subscription deployments (az deployment sub create) and
RG-based destroy (az group delete) with Azure Deployment Stacks across
all workflows and agent docs.

Why:
  Plain sub-deployments + RG-delete leave orphans when a template spans
  multiple RGs or creates sub-scope resources (role/policy assignments,
  cross-scope role grants, remote-side refs). Stacks track every managed
  resource across every scope as a single lifecycle unit, so destroy is
  one idempotent call regardless of how templates evolve. See Azure#30.

Workflow changes:
  - git-ape-deploy: az stack sub validate/create with
    --action-on-unmanage deleteAll --deny-settings-mode none.
    Captures stackId and managedResources[] into state.json (schema v1.0).
  - git-ape-destroy: az stack sub show (inventory) + az stack sub delete
    --action-on-unmanage deleteAll --bypass-stack-out-of-sync-error.
    Removed old Build-destroy-plan / sub-resource-sweep / RG-delete
    steps. Missing-stack path now records already-destroyed (idempotent).
  - git-ape-plan: az stack sub validate for validation; keep
    az deployment sub what-if (stacks do not support what-if yet).

Docs:
  - copilot-instructions.md: updated deploy/destroy descriptions and
    inline bash example to stacks commands.
  - azure-resource-deployer.agent.md: deploy and rollback patterns use
    az stack sub create/delete.
  - azure-template-generator.agent.md: CLI and PowerShell examples use
    deployment stacks.
  - git-ape.agent.md: Stage 3 description references stacks.
  - DEPLOYMENT_STATE.md: documents state.json schema v1.0 with stackId
    and managedResources[] fields.
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