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

Underlying type error when using Terraformer tool #16920

Closed
magandrez opened this issue Jan 8, 2024 · 4 comments
Closed

Underlying type error when using Terraformer tool #16920

magandrez opened this issue Jan 8, 2024 · 4 comments
Labels

Comments

@magandrez
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.6.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v5.10.0

Affected Resource(s)

  • google_*, although that's a bit irrelevant, see description of the problem.

Terraform Configuration Files

N/A / irrelevant, see description

Debug Output

N/A / irrelevant, see description

Panic Output

N/A / irrelevant, see description

Expected Behavior

When using terraformer tool, Terraform configs should be imported as .tf file(s) to the current folder.

Actual Behavior

An error is generated and an incomplete (empty) description of the Terraform state in tf files is generated (the expected behavior of Terraformer tool).

Steps to Reproduce

NOTE: This is exactly the same problem as described in linked issue below.

  1. Install Terraformer as described in their README.
  2. terraform init (state is remotely maintained on GCP Cloud Storage).
  3. gcloud auth application-default login --impersonate-service-account XXXXXXXXX@XXXXXXX.iam.gserviceaccount.com
  4. terraformer plan google --projects GCP_PROJECT_ID --regions GCP_REGION

Terraform definitions (.tf files) should be generated under ./generated folder, but instead, an empty plan.json is generated on the mentioned folder and stdout shows the following error pointing at a problem in terraform-provider-google and not a Terraformer problem itself is output from the above command:

2024/01/08 16:15:51 google importing project <REDACTED_GCP_PROJECT_ID> region <REDACTED_GCP_REGION>
2024-01-08T16:15:52.977+0200 [ERROR] plugin.terraform-provider-google_v5.10.0_x5: Response contains error diagnostic: diagnostic_summary="Value Conversion Error" tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/hashicorp/google
  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_attribute="" tf_req_id=a9b5672a-ac17-198d-50aa-0d525155e8a8 tf_rpc=Configure @caller=github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto timestamp="2024-01-08T16:15:52.977+0200"
2024/01/08 16:15:52 Saving planfile to generated/google/<REDACTED_GCP_PROJECT_ID>/terraformer/<REDACTED_GCP_REGION>/plan.json

Important Factoids

  • Terraformer error points at a problem with terraform-provider-google.

References

The following issue describes exactly the same problem (i.e.: the problem remains but the issue was not followed up)

@magandrez magandrez added the bug label Jan 8, 2024
@slevenick
Copy link
Collaborator

Do you know what resource is causing the problem? I guess I'm confused as to how this is a problem with the provider itself rather than the terraformer tool.

Is there a terraform import command that is being run that fails in the provider?

@magandrez
Copy link
Author

@slevenick Terraform tool itself works normally. No errors in logs or anything like that.

I am assuming the problem is an internal issue on the HCL language regarding how it describes basic data types. This seems to be of essence for Terraformer tool and there seems to be an inconsistency between the current state and the HCL definition of the data types involved in describing the state that Terraformer is attempting to reverse engineer.

Note that Terraformer is a side project at Google, not an official product, but neither a hobbyist work.

@slevenick
Copy link
Collaborator

@slevenick Terraform tool itself works normally. No errors in logs or anything like that.

I am assuming the problem is an internal issue on the HCL language regarding how it describes basic data types. This seems to be of essence for Terraformer tool and there seems to be an inconsistency between the current state and the HCL definition of the data types involved in describing the state that Terraformer is attempting to reverse engineer.

Note that Terraformer is a side project at Google, not an official product, but neither a hobbyist work.

If the problem is in HCL itself this repo wouldn't be the right place to report it.

If this is a problem with this provider we would need a way to reproduce the error using the provider itself.

As it stands I would recommend opening an issue on the Terraformer repo instead.

Copy link

github-actions bot commented Feb 9, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants