pulumi / pulumi-terraform-bridge

A library allowing Terraform providers to be bridged into Pulumi.
Apache License 2.0
192 stars 45 forks source link

PF Import generates values for properties with default values #2238

Open VenelinMartinov opened 1 month ago

VenelinMartinov commented 1 month ago

What happened?

When importing PF resources we generate code for properties which take the default values. This is not what the code in schema.go intends and not what the SDKv2 bridge does.

Likely related to https://github.com/pulumi/pulumi-terraform-bridge/issues/2218

Example

https://github.com/pulumi/pulumi-terraform-bridge/blob/5f7b9b60a4d84802253908d7d5b385f3142a962f/pf/tests/extract_inputs_test.go#L48

Output of pulumi about

.

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

t0yv0 commented 1 month ago

There's a few candidate resources in AWS to test this on an actual provider that do utilize stringdefault on string attributes, for example:

https://github.com/hashicorp/terraform-provider-aws/blob/master/internal/service/quicksight/namespace.go#L81 https://github.com/hashicorp/terraform-provider-aws/blob//internal/service/bedrockagent/agent_knowledge_base_association.go#L57

We could try importing them and demonstrating what happens.

I suspect that what happens is that pulumi generates a program that writes out the default values as literals. This program should work fine during pulumi up but is not the optimal/minimal program. IN this case this is not a bug but an feature request to optimize imported programs.