DFE on AWS -- Teardown
Provisioning: aws.md. Running the cluster: aws-operations.md.
Lifecycle tags
tags.lifecycle: ephemeral(tyre-kick, provision-test-destroy) is the one governance tag that changes what gets built, not only what gets labelled. It sets the CloudTrail bucket'sforce_destroy, the secret recovery windows on both the deployment's own secrets and the Kafka SCRAM credential (0 days instead of 30), and redpanda-cloud'sallow_deletion(true instead of the vendor's own default refusal) -- so a tyre-kick deployment tears down cleanly and anything else keeps the vendor's normal deletion protection, without a per-resource flag to remember. Everydfe-opscommand against an ephemeral dial also opens with one stderr line: the resolvedcompute_bucketfromsizing/resolved.yaml-- a T-shirt bucket, never a rate -- plus how long the cluster has been up, from the root'scluster_created_atoutput. Nothing in the tree dates a deployment -- a local state file's mtime dates the last apply, and the S3 backend leaves none here -- so the control plane's own stamp is the reading, and a dial with no cluster behind it reports the age unavailable. Neither reading may fail the command.- During a test run (
controller_tagsset) each managed node group launches through a launch template that puts the run's tags on its instances and root volumes, and every Karpenter pool is held topools.aws.runInstanceSizes. Outside a run there is a template only when the registry cache writes a node script, because adding one to an existing node group replaces the group.
Tearing down
- A full cloud cycle is batched, never run per finding (TESTING-CYCLE.md). Two halves bear on teardown: the managed cluster goes down first, being the long pole both ways, and teardown starts when the last proof lands, not at the end of a session.
bootstrap/destroy.shdeletes the node pools' Application,karpenter-pools-<cluster>found by its name, once the load balancers are released and keeps Karpenter itself until every NodeClaim is gone (up to 600s), because a node left running holds its subnets through its network interfaces andtofu destroyfails on them. On a test run its last step terminates any node a Karpenter pool launched for that run and cluster.- HyperDX's store keeps its volumes (reclaim policy
Retain) while it runs. Once the DocumentDB operator has gone,bootstrap/destroy.shsets the volumes labelleddocumentdb.io/cluster=dfe-documentdb,documentdb.io/namespace=cnpgtoDelete, so the EBS CSI driver deletes each one with its disk. Atofu destroyrun without it first leaves those disks behind. - Tear down with
tofu destroyinterraform/environments/aws, deleting the Kubernetes workloads first -- anything that made a load balancer, a volume or a DNS record did so through a controller, andtofu destroydoes not know about it. - An untargeted
tofu destroyon an MSK dial fails withClient configuration missinguntil the Redpanda credentials are in the environment. The root declaresprovider "redpanda", OpenTofu configures every provider the configuration requires whether or not the dial selects it, and that provider's client resolvesREDPANDA_CLIENT_IDandREDPANDA_CLIENT_SECRETor fails. Until the root stops requiring it, either export those two with any value for the run, or destroy by target. Do NOT reach for-exclude: it cannot be combined with-target.
Sweeping what is left
- Run
scripts/cloud_sweep.py --region <region>read-only to see what is left, add--exclude-bucket <state bucket>so the state store is never a candidate, and only add--deleteonce you have read the listing.--deleterequires--account <12-digit>, checked againstaws sts get-caller-identitybefore anything is touched -- refused on a mismatch or a missing--account, the same guard both tofu roots already carry against running against the wrong account.--deletealso prints the full eligible list and asks for a typedyesbefore deleting anything, and--yesskips that prompt for a CI run.--include-untaggedwidens the sweep to every resource the listers found, tagged or not, turning--deleteinto a region-wide wipe of the account (--exclude-bucketis the one exemption). Without it,--deleteonly ever removes resources carrying the tag filter. The AWS account defaults -- the default VPC and everything that comes with it, AWS-managed KMS aliases -- are never listed or touched. --expiredselects resources whosedfe-e2erun tag carries anexpires-atpast--grace(default 1h), plus any non-default security group with no run tag inside a VPC so selected -- EKS creates its cluster security group untagged and outside tofu state, and the VPC cannot be deleted while it stands. Unattended runs and their reaper: TESTING-CYCLE.md.