Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while running terraformer on google provider #1695

Open
Dajma opened this issue Apr 26, 2023 · 33 comments
Open

Getting error while running terraformer on google provider #1695

Dajma opened this issue Apr 26, 2023 · 33 comments

Comments

@Dajma
Copy link

Dajma commented Apr 26, 2023

Getting below error:

2023-04-26T05:11:12.776Z [ERROR] plugin.terraform-provider-google_v4.63.0_x5: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_attribute="" diagnostic_severity=ERROR diagnostic_summary="Value Conversion Error" tf_req_id=8f4a4a53-80a0-9b9a-5d77-c095be339355 @module=sdk.proto
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: google.ProviderModel
| Suggested types Type: basetypes.ObjectValue
| Suggested Pointer Type: *google.ProviderModel
tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/hashicorp/google tf_rpc=Configure timestamp=2023-04-26T05:11:12.776Z

@Yurati
Copy link

Yurati commented Apr 26, 2023

I'm having the same issue

@daichi-sato-xa
Copy link

I have the same issue.

  • terraformer: v0.8.22
  • Terraform: v1.4.6
  • GCP Provider: v4.63.1

@musyaf11
Copy link

musyaf11 commented May 3, 2023

I have the same issue and even tried to change the versions for Terraformer (v0.8.19, v08.17)

@nicklinnell
Copy link

Same for me, it was working fine but all of sudden has broken with the above error.

  • Terraformer: v0.8.22
  • Terraform: v1.4.2
  • GCP provider v4.36.1

I tried downgrading the GCP provider but get the same issue. I've tried using a different Service account and running a docker container too

@musyaf11
Copy link

musyaf11 commented May 5, 2023

@nicklinnell , I fixed my case by downgrading the GCP provider to v4.60.0. It works well for me.

@nicklinnell
Copy link

@musyaf11 Unfortunately that didn't fix it for me I I still get the same error:

2023-05-05T10:04:52.501Z [ERROR] plugin.terraform-provider-google_v4.60.0_x5: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_summary="Value Conversion Error" tf_provider_addr=registry.terraform.io/hashicorp/google 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: google.ProviderModel
  | Suggested `types` Type: basetypes.ObjectValue
  | Suggested Pointer Type: *google.ProviderModel
   diagnostic_severity=ERROR tf_proto_version=5.3 tf_req_id=443f128a-5d0a-02cf-e1f4-cb4d82478ddd tf_rpc=Configure timestamp=2023-05-05T10:04:52.500Z

@musyaf11
Copy link

musyaf11 commented May 5, 2023

@nicklinnell , want to ensure that you have done the following steps as follows:

  • delete .terraform folder
  • delete generated folder
  • delete .lock files
  • re-initialize the provider

@stephen-dunne
Copy link

stephen-dunne commented May 5, 2023

Following along as well, just started looking at terraformer for use with our google cloud DNS setup. Looks like I picked a good time to start ! :D

Followed the steps above to wipe env. Have successfully pinned the provider to 4.60.0 as shown below but error still occurring

C:\Users\steved\Documents\dns\******>terraform init

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/google versions matching "4.60.0"...
- Installing hashicorp/google v4.60.0...
- Installed hashicorp/google v4.60.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

C:\Users\steved\Documents\dns\******>terraformer plan google --resources=dns --projects=******* --regions=europe-west2
2023/05/05 11:18:19 google importing project ******* region europe-west2
2023-05-05T11:18:21.009+0100 [ERROR] plugin.terraform-provider-google_v4.60.0_x5.exe: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 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: google.ProviderModel
  | Suggested `types` Type: basetypes.ObjectValue
  | Suggested Pointer Type: *google.ProviderModel
   tf_proto_version=5.3 tf_req_id=8abde5cc-24c6-3298-769e-ea5181d05d53 @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="Value Conversion Error" tf_provider_addr=registry.terraform.io/hashicorp/google tf_rpc=Configure timestamp="2023-05-05T11:18:21.008+0100"```

Also spews out the following, not sure if related

2023/05/05 11:18:25 rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:50264->127.0.0.1:10000: wsarecv: An existing connection was forcibly closed by the remote host.
2023/05/05 11:18:25 WARN: Fail read resource from provider, wait 300ms before retry

e2a:

C:\Users\steved\Documents\dns\******>terraform --version
Terraform v1.4.6
on windows_amd64
+ provider registry.terraform.io/hashicorp/google v4.60.0

C:\Users\steved\Documents\dns\******>terraformer version
Terraformer v0.8.22

@nicklinnell
Copy link

@musyaf11 yes, I'm actually running this in a "clean" docker container the reinitialises terraform new each time it runs so there are no files other than a main.tf containing:

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "4.60.0"
    }
  }
  required_version = ">= 0.13"
}
provider "google" {
  credentials = file("/mycreds.json")
}

@musyaf11
Copy link

musyaf11 commented May 5, 2023

@nicklinnell, not sure what the cause of this error, is since I even tried to change the GCP provider to 4.0.0. and it works well for me. My colleague at work also tried this and it works as well for him as well.

btw, here are the versions on my end and colleagues:

  • Terraform v1.4.6
  • Terraformer v.0.8.22
  • GCP v.4.0.0/4.6.0

@stephen-dunne
Copy link

FYI, stepping back again to GCP 4.0.0 after wiping the environment worked for me !

@nicklinnell
Copy link

Thanks @musyaf11 and @stephen-dunne I can confirm switching to GCP v4.0.0 fixes the issue for me

@somaz94
Copy link

somaz94 commented May 9, 2023

@nicklinnell

what is GCP v4.0.0?

The same error occurs to me.

How do you solve it?

my version

  • Google Cloud SDK 422.0.0
  • bq 2.0.88
  • bundled-python3-unix 3.9.16
  • core 2023.03.10
  • gcloud-crc32c 1.0.0
  • gsutil 5.21
  • Updates are available for some Google Cloud CLI components. To install them,
  • please run:

@samveen
Copy link
Contributor

samveen commented May 9, 2023

@somaz94 :

what is GCP v4.0.0?

That is provider version, as below in the tf configuration (modify after export from terraformer):

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

@somaz94
Copy link

somaz94 commented May 10, 2023

WOW! thank you for @samveen

I solve the problem

@lbpage
Copy link

lbpage commented May 12, 2023

Just adding my 2 cents here. I had the same problem and then changed to 4.0.0 and it worked, but what exactly is breaking in the provider?

@cliffom
Copy link

cliffom commented May 15, 2023

Came here with the same question and wanted to config downgrading to 4.0.0 solved the issue. Will be good to see if it gets resolved but thanks for the solution!

@yclian
Copy link

yclian commented May 20, 2023

I can confirm too that downgrading to 4.0.0 is a workaround for now.

@ronjarrell
Copy link

4.60 didn't wor for me, but 4.0 did. But that means the imports probably are missing new things that the current provider has that 4.00 didn't.

@gmuench-cog
Copy link

gmuench-cog commented Jul 11, 2023

I found that 4.59.0 is the highest "hashicorp/google" provider version that works with Terraformer as of 7/11/23.

Terraformer v0.8.24 (darwin_arm64)
Terraform v1.5.2 (darwin_arm64)
terraform-provider-google_v4.59.0_x5 (darwin_arm64)

I also tried with a full amd_64 stack and got the same results.

ioah86 added a commit to coguardio/coguard-cli that referenced this issue Sep 6, 2023
GoogleCloudPlatform/terraformer#1695
states that any version of the GCP provider after 4.60.0 is
having an issue. Fixing the version for now.
ioah86 added a commit to coguardio/coguard-cli that referenced this issue Sep 6, 2023
COS-417 - Avoid gcp bug

GoogleCloudPlatform/terraformer#1695
states that any version of the GCP provider after 4.60.0 is
having an issue. Fixing the version for now.
@github-actions
Copy link

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 github-actions bot added the Stale label Sep 11, 2023
@pataquets
Copy link

@sergeylanzman issue stands and is being worked on. Can anyone please remove the stale label to avoid keep alives' noise?

@github-actions github-actions bot removed the Stale label Sep 18, 2023
@srbharath
Copy link

Thanks @musyaf11 and @stephen-dunne I can confirm switching to GCP v4.0.0 fixes the issue for me

@azonlim
Copy link

azonlim commented Oct 10, 2023

Hi, Community,
I'm trying to export existing Google Cloud Function, but unfortunately:

MacBook-Pro terraform-repo % terraformer import google --resources=cloudFunctions --projects=dev-project --regions=us-central1

2023/10/10 17:43:36 google importing project dev-project region us-central1

2023/10/10 17:43:39 google importing... cloudFunctions

2023/10/10 17:43:39 google done importing cloudFunctions

2023/10/10 17:43:39 Number of resources for service cloudFunctions: 0

2023/10/10 17:43:39 google Connecting....

2023/10/10 17:43:39 google save cloudFunctions

2023/10/10 17:43:39 google save tfstate for cloudFunctions

Google Cloud SDK 449.0.0
beta 2023.10.02
bq 2.0.98
config-connector 1.93.0
core 2023.10.02
gcloud-crc32c 1.0.0
gsutil 5.26
terraform-tools 0.11.1

Could someone help, please?

@ronjarrell
Copy link

Problem exists with the 5.x providers as well

@chandanpasunoori
Copy link

chandanpasunoori commented Jan 5, 2024

Any update on this? its failing in 5.10.0 too

@magandrez
Copy link

magandrez commented Jan 12, 2024

The issue originally described remains an issue.

In my case, I cannot downgrade provider versions as I am dealing with production environments (regardless, downgrading a major version of a software component is not a resolution to a bug).

I have reported the issue on the registry side (read, on hashicorp/terraform-provider-google but I was told "it is not their problem").

For reference, the bug I opened: hashicorp/terraform-provider-google#16920 a similar one opened by someone else here: hashicorp/terraform-provider-google#15059

Is this project being actively supported? @jpatokal @nckslvrmn @vgavro

@nckslvrmn
Copy link
Contributor

Is this project being actively supported? @jpatokal @nckslvrmn @vgavro

I am not a regular maintainer of this project so I cannot speak to its active support, I just enjoy it and needed to fix something for my own use with the tool which got recently merged :)

@ArinKim
Copy link

ArinKim commented Jan 31, 2024

Are there any updates? It's still failing on the recent version

@samveen
Copy link
Contributor

samveen commented Feb 10, 2024

Google has a preview feature for exporting a project as terraform as described at https://cloud.google.com/docs/terraform/resource-management/export. List of supported types is as below:

samveen@zero2w:~ $ gcloud beta resource-config list-resource-types
Listing exportable resource types for project [xxxx-yyyy]...done.
┌───────────────────────────────┬──────────────┬─────────┬──────┐
│            KRM KIND           │ BULK EXPORT? │ EXPORT? │ IAM? │
├───────────────────────────────┼──────────────┼─────────┼──────┤
│ ArtifactRegistryRepository    │ x            │ x       │ x    │
│ ComputeAddress                │ x            │ x       │      │
│ ComputeBackendBucket          │ x            │ x       │      │
│ ComputeBackendService         │ x            │ x       │      │
│ ComputeDisk                   │ x            │ x       │ x    │
│ ComputeHealthCheck            │ x            │ x       │      │
│ ComputeImage                  │ x            │ x       │ x    │
│ ComputeInstance               │ x            │ x       │ x    │
│ ComputeInstanceGroup          │ x            │ x       │      │
│ ComputeInstanceTemplate       │ x            │ x       │      │
│ ComputeNetwork                │ x            │ x       │      │
│ ComputeNetworkEndpointGroup   │ x            │ x       │      │
│ ComputeResourcePolicy         │ x            │ x       │      │
│ ComputeRoute                  │ x            │ x       │      │
│ ComputeSecurityPolicy         │ x            │ x       │      │
│ ComputeSnapshot               │ x            │ x       │      │
│ ComputeSubnetwork             │ x            │ x       │ x    │
│ ContainerCluster              │ x            │ x       │      │
│ ContainerNodePool             │ x            │         │      │
│ DNSManagedZone                │ x            │ x       │      │
│ IAMServiceAccount             │ x            │         │ x    │
│ IAMServiceAccountKey          │              │         │      │
│ LoggingLogSink                │ x            │         │      │
│ MonitoringAlertPolicy         │ x            │         │      │
│ MonitoringNotificationChannel │              │         │      │
│ Project                       │ x            │ x       │ x    │
│ SQLInstance                   │ x            │ x       │      │
│ Service                       │ x            │ x       │      │
│ StorageBucket                 │ x            │         │ x    │
└───────────────────────────────┴──────────────┴─────────┴──────┘

@tanguynicolas
Copy link

tanguynicolas commented Feb 12, 2024

I found that 4.59.0 is the highest "hashicorp/google" provider version that works with Terraformer as of 7/11/23.

Where is the official documentation that mention this?
It should be written here.

Copy link

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 github-actions bot added the Stale label Apr 14, 2024
@samveen
Copy link
Contributor

samveen commented Apr 14, 2024

This is still an issue as of now.

@github-actions github-actions bot removed the Stale label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests