All Projects → jckuester → terradozer

jckuester / terradozer

Licence: MIT License
Terraform destroy without configuration files

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
HCL
1544 projects
Makefile
30231 projects

Projects that are alternatives of or similar to terradozer

Terraforming
Export existing AWS resources to Terraform style (tf, tfstate) / No longer actively maintained
Stars: ✭ 4,232 (+11036.84%)
Mutual labels:  terraform, tfstate
terraform-aws-remote-state-s3-backend
A terraform module to set up remote state management with S3 backend for your account.
Stars: ✭ 71 (+86.84%)
Mutual labels:  terraform
destroy
destroy a stream if possible
Stars: ✭ 51 (+34.21%)
Mutual labels:  destroy
terraform-aws-mongodb
Simplify MongoDB provisioning on AWS using Terraform
Stars: ✭ 20 (-47.37%)
Mutual labels:  terraform
yor
Extensible auto-tagger for your IaC files. The ultimate way to link entities in the cloud back to the codified resource which created it.
Stars: ✭ 459 (+1107.89%)
Mutual labels:  terraform
fortigate-terraform-deploy
Deployment templates for FortiGate-VM on cloud platforms with terraform
Stars: ✭ 30 (-21.05%)
Mutual labels:  terraform
js-cleanup
Smart comment and whitespace cleaner for JavaScript-like files
Stars: ✭ 22 (-42.11%)
Mutual labels:  cleanup
vcs-fitcycle-deployer
Automates the deployment of EC2 based App by using Terraform and Ansible
Stars: ✭ 13 (-65.79%)
Mutual labels:  terraform
terraform-aws-eks
Terraform Module: Amazon EKS
Stars: ✭ 64 (+68.42%)
Mutual labels:  terraform
terraform-provider-bigip
Terraform resources that can configure F5 BIG-IP products
Stars: ✭ 74 (+94.74%)
Mutual labels:  terraform
terraform-provider-vercel
Terraform Provider for Vercel (former ZEIT)
Stars: ✭ 36 (-5.26%)
Mutual labels:  terraform
terraform-provider-nutanix
Terraform Nutanix Provider
Stars: ✭ 53 (+39.47%)
Mutual labels:  terraform
terraform-cloudinit-container-server
A batteries included cloud-init config to quickly and easily deploy a single Docker image or Docker Compose file to any Cloud™ VM.
Stars: ✭ 52 (+36.84%)
Mutual labels:  terraform
aws-terraform
AWS & Terraform Rocket Start Guide
Stars: ✭ 53 (+39.47%)
Mutual labels:  terraform
terraform-provider-terraform
Terraform terraform provider
Stars: ✭ 24 (-36.84%)
Mutual labels:  terraform
terraform-aws-rabbitmq
A terraform module to deploy a rabbitmq cluster with AutoScaling Group and Load Balancer
Stars: ✭ 25 (-34.21%)
Mutual labels:  terraform
terraform-aws-bigip
BIG-IP AWS module for the Terraform Registry
Stars: ✭ 12 (-68.42%)
Mutual labels:  terraform
devops-governance
Example end-to-end Governance Model from CI/CD to Azure Resource Manager. Use this project to deploy example AAD, ARM and Azure DevOps resources to learn about e2e RBAC.
Stars: ✭ 79 (+107.89%)
Mutual labels:  terraform
cloud-computer
☁️ The Cloud Native Computer
Stars: ✭ 5 (-86.84%)
Mutual labels:  terraform
docker-registry-util
Search and cleanup on Docker Registry v2.
Stars: ✭ 27 (-28.95%)
Mutual labels:  cleanup

terradozer

terradozer

Terraform destroy using the state only - no *.tf files needed


Release Software License Travis Codecov branch Go Doc

Terradozer takes a Terraform state file as input and destroys all resources it finds in it - without needing any *.tf files. This works currently only for resources of the Terraform AWS Provider. If you need support for any other provider, let me know, and I will try to help.

Happy (terra)dozing!

Example

Features

  • Nothing will be deleted without your confirmation. Terradozer always lists all resources first and then waits for your approval
  • Using the -force flag (dangerous!), terradozer can run in an automated fashion without human interaction and approval, for example, as part of your CI pipeline
  • Planned, if you want me to implement this, please upvote: Allow terradozer pointing directly to a state file stored in S3, i.e., terradozer s3://path/to/terraform.tfstate
  • Planned, if you want me to implement this, please upvote: A -recursive flag to delete resources of all states found under a given directory, i.e., terradozer -recursive s3://bucket-with-states/. This is especially helpful if you orchestrate Terraform modules with Terragrunt and store all states under the same directory or in the same S3 bucket. This way, a complete Terragrunt project could be cleaned up in an automated fashion.

Installation

It's recommended to install a specific version of terradozer available on the releases page.

Here is the recommended way to install terradozer v0.1.2:

# install it into ./bin/
curl -sSfL https://raw.githubusercontent.com/jckuester/terradozer/master/install.sh | sh -s v0.1.2

Usage

To delete all resources in a Terraform state file:

terradozer [flags] <path/to/terraform.tfstate>

To see all options, run terradozer --help. Provide credentials for the AWS account you want to destroy resources in via the usual environment variables, e.g., AWS_PROFILE=<myaccount> and AWS_DEFAULT_REGION=<myregion>.

The region information is needed as it is not stored as part of the state. Having multiple providers wit different regions in one state file is not yet supported.

How it works

Terradozer first scans a given Terraform state file (read-only) to find all resources (excluding data sources), then downloads the necessary Terraform Provider Plugins to call the destroy function for each resource on the respective CRUD API via GRPC (e.g., calling the Terraform AWS Provider to destroy a aws_instance resource).

Tests

This section is only relevant if you want to contribute to Terradozer and therefore run the tests. Terradozer has acceptance tests, integration tests checking against changes of behaviour in the Terraform Provider API, and of course unit tests.

Run unit tests

make test

Run acceptance and integration tests

AWS_PROFILE=<myaccount> AWS_DEFAULT_REGION=<myregion> make test-all
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].