-
Notifications
You must be signed in to change notification settings - Fork 3
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
panic in pulumi convert from terraform - gcp cloud-foundation-fabric #27
Comments
This is a bug in the converter plugin itself, not pulumi codegen. Moving to relevant repo. |
OK so it's not ideal this is a panic, but it's panic because the terraform code itself is actually malformed. That repo has some dynamic blocks that refer to an "each" variable which doesn't actually exist: https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/blob/master/modules/bigquery-dataset/main.tf#L88-L97 (added by PR GoogleCloudPlatform/cloud-foundation-fabric#1480). So we have a decision to make about what we should do in this case. Currently we panic. Open to thoughts on what would be most user friendly here. |
I'll probably lean toward user education and pointing out what's broken in their TF code. One they get a chance to address the issue since they own their own code, and two, we don't hide/mask something is incorrect in the first place. Happy to hear what others think about. |
I'd lean towards this. Is this easy enough to do for this case and other cases of invalid TF code? Or will it end up being a case-by-case thing converting various features from TF to PCL? I see how the other options could be attractive, if we wanted the conversion to "succeed," but then the user is going to have to go fix-up the converted pulumi code that won't work. Seems better to tell them up-front that the TF is invalid (if we can) and needs to be fixed before it can be converted. |
It's not hard, but a bit of grunt work because errors currently aren't fed through this part of the code. It will end up being a case-by-case thing. There's a few places in the converter that still panic and I haven't looked into them all deeply to see if it's an assumption that should always hold, or only hold for valid Terraform. |
I'd like to be able to debug the error, to know where the problem in Terraform lies. How can I do that? |
I'll fix this up to return an error pointing to the TF source location, but in the meantime for this case the error is the dynamic blocks in https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/blob/master/modules/bigquery-dataset/main.tf#L88-L97 which are using "each" as an iteration variable. They should be using the dynamic block name instead. |
I've update the converter to error not panic on this. Converting the linked code above now gives a set of errors:
I'll close this and get a new release of the converter published. |
What happened?
Cloned Terraform modules from https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git
Tried to convert fast/stages/0-bootstrap from Terraform to Pulumi Typescript.
On Windows, error:
On Linux, Error:
Expected Behavior
Successful conversion from Terraform to Pulumi Typescript
Steps to reproduce
Output of
pulumi about
Unix
`CLI
Version 3.80.0
Go Version go1.21.0
Go Compiler gc
Host
OS ubuntu
Version 22.04
Arch x86_64
Pulumi locates its logs in /tmp by default`
Windows
`CLI
Version 3.80.0
Go Version go1.21.0
Go Compiler gc
Host
OS Microsoft Windows 11 Pro
Version 10.0.22621 Build 22621
Arch x86_64
Backend
Name pulumi.com`
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: