jckuester / terradozer

Terraform destroy without configuration files
MIT License
163 stars 17 forks source link

GCP Support #2

Open asyd opened 4 years ago

asyd commented 4 years ago

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

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

Cheers

jckuester commented 4 years ago

Hi @asyd.

I am happy to support GCP, but I'd appreciate some information about the GCP provider from you, since I haven't used GCP yet really:

1) I have seen there is google and google-beta (https://www.terraform.io/docs/providers/google/index.html), do you need both?

2) What parameters (credentials, region, etc) are required to configure the GCP provider? I'd like to make those configurable via environment variables for now (for AWS those environment variables are, as mentioned in the README, for example, AWS_PROFILE, AWS_DEFAULT_REGION, etc.

asyd commented 4 years ago
  1. At this moment google will be enough for me
  2. A project_id (can be an environment variable), and a credentials file (usually a JSON one)

Thanks @jckuester

jckuester commented 4 years ago

FYI, I opened PR https://github.com/jckuester/terradozer/pull/3, but it's not working for me, yet.

When I run GOOGLE_REGION=us-central1 GOOGLE_CREDENTIALS=some-credentials.json terradozer -debug terraform.tfstate, I get

   • READING STATE    
      • using state                                        file=test/test-fixtures/single-resource-gcp/terraform.tfstate
      • providers found in state                           addresses=[provider.google]
      • downloaded and installed provider                  name=google version=3.11.0
      • configured provider                                name=google version=3.11.0
      • looked up resource instance address                absolute_address=google_compute_network.vpc_network
   • SHOWING RESOURCES THAT WOULD BE DELETED (DRY RUN)
      • start distributing resources to workers for this run
      • worker starts deleting resource                    id=projects/terradozer-acc-test/global/networks/terraform-network type=google_compute_network worker_id=10
      • unable to delete resource                          error=failed to read current state of resource: Error reading ComputeNetwork "projects/terradozer-acc-test/global/networks/terraform-network": Get projects/terradozer-acc-test/global/networks/terraform-network?alt=json: unsupported protocol scheme "" id=projects/terradozer-acc-test/global/networks/terraform-network type=google_compute_network
   • ALL RESOURCES HAVE ALREADY BEEN DELETED

Not sure what's missing yet...