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

Error when import using Google provider #1857

Closed ivanrivai-smma closed 8 months ago

ivanrivai-smma commented 8 months ago

when i try to run this command: terraformer import google --projects xxx --resources=firewall --regions asia-southeast2

got this error below: 2024-03-25T13:47:02.043+0700 [ERROR] plugin.terraform-provider-google_v5.21.0_x5: Response contains error diagnostic: diagnostic_attribute="" 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" @caller=github.com/hashicorp/terraform-plugin-go@v0.20.0/tfprotov5/internal/diag/diagnostics.go:62 @module=sdk.proto tf_rpc=Configure tf_proto_version=5.4 tf_provider_addr=registry.terraform.io/hashicorp/google tf_req_id=92996a22-50d1-e6c1-8978-5a912fe07e8e timestamp="2024-03-25T13:47:02.042+0700"

i am using:

Is this a version imcompatibility, outdated go version, or any other reason?

Thank you.

zachmitch commented 8 months ago

@ivanrivai-smma in another issue thread they had the same problem (me too).

I fixed it by changing my versions.tf for google to 4.0.0:

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "4.0.0"
    }
  }
  required_version = ">= 0.13"
}

https://github.com/GoogleCloudPlatform/terraformer/issues/1695

ivanrivai-smma commented 8 months ago

@ivanrivai-smma in another issue thread they had the same problem (me too).

I fixed it by changing my versions.tf for google to 4.0.0:

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "4.0.0"
    }
  }
  required_version = ">= 0.13"
}

1695

thanks man, so it was the provider version!