pulumi / pulumi-converter-terraform

Apache License 2.0
9 stars 3 forks source link

Convert from terraform to python fails with code generation error #226

Open seanr-ba opened 2 days ago

seanr-ba commented 2 days ago

What happened?

Attempted to convert terraform repo to pulumi using:

pulumi convert --from terraform --language python

but received the following error:

The Pulumi CLI encountered a code generation error. This is a bug!
We would appreciate a report: https://github.com/pulumi/pulumi/issues/
Please provide all of the below text in your report.

Pulumi Version:   v3.140.0

error: main.pp:60,1-63,2: /tmp/pulumi-convert934795143/modules/s3/iam.pp:1,76-90: unknown property 'ses_policy' among [sesPolicy bucketName ignorePublicAcls projectTag eventbridgeNotification restrictPublicBuckets s3Notification blockPublicAcls blockPublicPolicy bucketKeyEnabled]; , and 1 other diagnostic(s); /tmp/pulumi-convert934795143/modules/s3/iam.pp:1,76-90: unknown property 'ses_policy' among [sesPolicy bucketName ignorePublicAcls projectTag eventbridgeNotification restrictPublicBuckets s3Notification blockPublicAcls blockPublicPolicy bucketKeyEnabled]; , and 1 other diagnostic(s)
error: main.pp:65,1-71,2: /tmp/pulumi-convert934795143/modules/lambda/schedule.pp:8,60-73: unknown property 'functionName' among [replacementSecurityGroupIds runtime signingProfileVersionArn skipDestroy sourceCodeSize packageType urn arn codeSigningConfigArn environment lastModified reservedConcurrentExecutions s3ObjectVersion ephemeralStorage imageUri memorySize publish qualifiedArn sourceCodeHash tags version architectures deadLetterConfig invokeArn layers snapStart vpcConfig codeSha256 description handler s3Bucket s3Key kmsKeyArn loggingConfig tagsAll timeout imageConfig name role signingJobArn tracingConfig id code fileSystemConfig qualifiedInvokeArn replaceSecurityGroupsOnDestroy]; ; /tmp/pulumi-convert934795143/modules/lambda/schedule.pp:8,60-73: unknown property 'functionName' among [replacementSecurityGroupIds runtime signingProfileVersionArn skipDestroy sourceCodeSize packageType urn arn codeSigningConfigArn environment lastModified reservedConcurrentExecutions s3ObjectVersion ephemeralStorage imageUri memorySize publish qualifiedArn sourceCodeHash tags version architectures deadLetterConfig invokeArn layers snapStart vpcConfig codeSha256 description handler s3Bucket s3Key kmsKeyArn loggingConfig tagsAll timeout imageConfig name role signingJobArn tracingConfig id code fileSystemConfig qualifiedInvokeArn replaceSecurityGroupsOnDestroy]; 
error: could not generate output program

Example

See above for full error details

Output of pulumi about

CLI          
Version      3.140.0
Go Version   go1.23.3
Go Compiler  gc

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

Backend        
Name           pulumi.com
URL            https://app.pulumi.com
User           Unknown
Organizations  
Token type     personal

Pulumi locates its logs in /tmp by default
warning: Failed to read project: no Pulumi.yaml project file found (searching upwards from /home/sagemaker-user/ops-radar-infra). If you have not created a project yet, use `pulumi new` to do so: no project file found
warning: Failed to get information about the current stack: no Pulumi.yaml project file found (searching upwards from /home/sagemaker-user/ops-radar-infra). If you have not created a project yet, use `pulumi new` to do so: no project file found

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).

Frassle commented 2 days ago

This looks like a renaming issue in the converter itself, so I'll move to that repo.

zbuchheit commented 3 hours ago

I have also encountered this error but when attempting to bridge a provider and using codegen for the examples. When attempting with the provider in my scenario I get

unknown property 'defaults_version' among [... defaultsVersion ...]. This example will be dropped from any generated docs or SDKs.

When running in a debugger, I see this is happening for a UnionType. I am not sure if this is incorrect, but looking further in the debugs, YAML and Java seem to succeed, while python, go, typescript, and C# get reported as failed conversions.

When looking at the evaluation at https://github.com/pulumi/pulumi/blob/cf6fd7534845cb47743d205177090bf0b67e3a55/pkg/codegen/hcl2/model/type_object.go#L110 propertyName is defaults_version while t.Properties only contains the camel case equivalent defaultsVersion