GoogleCloudPlatform / terraformer

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Apache License 2.0
12.67k stars 1.65k forks source link

Cannot fetch token: 400 Bad Request with Google #1894

Closed tomascharad closed 2 months ago

tomascharad commented 4 months ago

Hi!

First, thank you very much for this tool, I'm very excited about starting using it. I'm trying to use the tool, but I cannot pass the following authentication error. I've tried with different versions of the Google provider, but i'm still facing the same issue. Many thanks!

Terraform: v1.9.0 Terraformer: v0.8.24 Terraform provider google: v5.36.0

tomascharad@Tomass-MacBook-Pro-2 xxx-infrastructure % terraformer plan google --projects=gke-poc-421401
2024/07/02 18:28:40 google importing project gke-poc-421401 region global
2024/07/02 18:28:40 Get "https://compute.googleapis.com/compute/v1/projects/gke-poc-421401/regions/global?alt=json&prettyPrint=false": oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
2024-07-02T18:28:41.572-0400 [ERROR] plugin.terraform-provider-google_v5.36.0_x5: Response contains error diagnostic: diagnostic_attribute="" tf_req_id=594438f0-352b-1abc-87be-5a39e2dac807 @caller=github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto tf_proto_version=5.4 tf_provider_addr=registry.terraform.io/hashicorp/google tf_rpc=Configure
  diagnostic_detail=
  | An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
  | 
  | Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
  | 
  | Path: 
  | Target Type: fwmodels.ProviderModel
  | Suggested `types` Type: basetypes.ObjectValue
  | Suggested Pointer Type: *fwmodels.ProviderModel
   diagnostic_severity=ERROR diagnostic_summary="Value Conversion Error" timestamp=2024-07-02T18:28:41.572-0400
2024/07/02 18:28:41 Saving planfile to generated/google/gke-poc-421401/terraformer/global/plan.json
feriva22 commented 4 months ago

same issue here

feriva22 commented 4 months ago

If you have issue with Bad Request, you need set service account in your machine, at least Viewer Permissions , but after setup the service account still error with message "Value Conversion Error"

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 7 days with no activity.