oxid destroy
Destroy all managed infrastructure resources in the correct dependency order.
Usage
oxid destroy [flags]
The destroy command removes all resources managed by Oxid. Resources are destroyed in reverse dependency order - resources that depend on others are destroyed first, ensuring clean teardown without orphaned references.
Confirmation
By default, Oxid requires confirmation before destroying resources:
$ oxid destroy Oxid will destroy the following resources: - aws_instance.api - aws_security_group.web - aws_s3_bucket.logs - aws_subnet.public[0] - aws_subnet.public[1] - aws_internet_gateway.main - aws_vpc.main Plan: 7 resources will be destroyed. Do you really want to destroy all resources? (yes/no): yes Destroying aws_instance.api... aws_instance.api: Destroyed (31.2s) Destroying aws_security_group.web... aws_security_group.web: Destroyed (1.4s) Destroying aws_s3_bucket.logs... aws_s3_bucket.logs: Destroyed (0.9s) Destroying aws_subnet.public[0]... aws_subnet.public[0]: Destroyed (1.1s) Destroying aws_subnet.public[1]... aws_subnet.public[1]: Destroyed (1.0s) Destroying aws_internet_gateway.main... aws_internet_gateway.main: Destroyed (0.8s) Destroying aws_vpc.main... aws_vpc.main: Destroyed (1.3s) Destroy complete. 7 resources destroyed.
Reverse Dependency Order
Oxid analyzes the dependency graph and destroys resources in reverse topological order. For example, an EC2 instance that references a security group will be destroyed before the security group, and subnets will be destroyed before their VPC.
Independent resources at the same level are destroyed in parallel, respecting the configured parallelism limit.
Flags
| Flag | Description | Default |
|---|---|---|
| --target <address> | Destroy only a specific resource and its dependents. Resources that depend on the target are also destroyed. | all resources |
| --auto-approve | Skip the confirmation prompt. | false |
| --parallelism <n> | Maximum number of concurrent destroy operations. | 10 |
Targeted Destroy
Destroy a specific resource and everything that depends on it:
$ oxid destroy --target aws_vpc.main Oxid will destroy the following resources: - aws_instance.api (depends on aws_vpc.main) - aws_subnet.public[0] (depends on aws_vpc.main) - aws_subnet.public[1] (depends on aws_vpc.main) - aws_internet_gateway.main (depends on aws_vpc.main) - aws_vpc.main Plan: 5 resources will be destroyed.
CI/CD Usage
For automated teardown in pipelines:
oxid destroy --auto-approve