GithubHelp home page GithubHelp logo

jckuester / terradozer Goto Github PK

View Code? Open in Web Editor NEW
161.0 4.0 17.0 714 KB

Terraform destroy without configuration files

License: MIT License

Go 74.75% HCL 10.54% Makefile 1.67% Shell 13.04%
aws terraform golang delete destroy cleanup cloud tfstate

terradozer's People

Contributors

chenrui333 avatar gliptak avatar jckuester avatar vsilgalis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

terradozer's Issues

S3 path to state file

terradozer s3://path/to/terraform.tfstate

Allow terradozer pointing directly to a state file stored in S3.

failed to dry-run on the old provider tfstate

$ terradozer -dry-run tfstate.json

   • READING STATE
      • using state                                        file=tfstate.json
      • downloaded and installed provider                  name=aws version=2.68.0

Error:️ failed to initialize Terraform providers: failed to configure provider (name=aws, version=2.68.0): Invalid AWS Region:

failed to remove aws_db_event_subscription

Here is the actual resource:

            "aws_db_event_subscription.tfer--210242135891": {
                "type": "aws_db_event_subscription",
                "depends_on": [],
                "primary": {
                    "id": "210242135891",
                    "attributes": {
                        "id": "210242135891",
                        "name": "210242135891"
                    },
                    "meta": {
                        "schema_version": 0
                    },
                    "tainted": false
                },
                "deposed": [],
                "provider": "provider.aws"
            }

And here is the run log:

terradozer tfstate.json

   • READING STATE
      • using state                                        file=tfstate.json
      • downloaded and installed provider                  name=aws version=2.68.0
      • configured provider                                name=aws version=2.68.0
      • cannot refresh resource state                      error=failed to read current state of resource: error retrieving RDS Event Subscription (210242135891): InvalidParameterValue: Invalid subscription name:  210242135891
	status code: 400, request id: 40ad084d-d654-4dca-b343-0ed056816ed1 resource_id=210242135891 type=aws_db_event_subscription
   • SHOWING RESOURCES THAT WOULD BE DELETED (DRY RUN)
   • ALL RESOURCES HAVE ALREADY BEEN DELETED

GCP Support

Hello Jan-Christoph, it's me again :)

Have you planned to support others providers than aws, like GCP by chance?

Cheers

Does not seem to work with Terraform v1.2.3

Hi Jan-Christoph,

I'd like to use this rather often (especially while working on terraform-aws-modules), but it does not seem to work with later version of Terraform:

$ terradozer --version

version: 0.1.2
commit: 48e53cb
built at: 2020-06-28T13:28:01Z
using: go1.13.12

$ terradozer -dry-run terraform.tfstate
Error:️ failed to read Terraform state file: failed reading terraform.tfstate as a statefile: state snapshot was created by Terraform v1.2.3, which is newer than current v0.12.25; upgrade to Terraform v1.2.3 or greater to work with this state

Am I doing something wrong?

failed to remove network_interface resources

It looks like terradozer does not support to remove network_interface resources?

  • aws_network_interface                              error=Error detaching ENI: OperationNotPermitted: You are not allowed to manage 'ela-attach' attachments.
status code: 400, request id: d21b2dbf-6aca-4784-b02f-3502c6e51a70 id=eni-044a15a3b3e1d1162

in my case my tfstate.json consists of aws_network_interface resources only.

ARM support (M1/M2 Macbooks)

Error installing onto a 2021 16" Macbook Pro (M1 Pro)

curl -sSfL https://raw.githubusercontent.com/jckuester/terradozer/master/install.sh | sh -s v0.1.2 jckuester/terradozer crit platform darwin/arm64 is not supported. Make sure this script is up-to-date and file request at https://github.com/jckuester/terradozer/issues/new

Typo in README.md

In the sentence "Having multiple providers wit different regions in one state file is not yet supported." there is an 'h' missing in the 'with' :)

-recursive flag

terradozer -recurive <directory/containing/states>

Delete resources of all states found under a given directory. This is especially helpful if you orchestrate Terraform projects with Terragrunt and store states under the same directory or in the same S3 bucket. This way, a complete Terragrunt project can be cleaned up in an automated fashion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.