pulumi / pulumi-terraform-bridge

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

10s slowdown due inefficient check_config validations for Plugin Framework #1448

Open t0yv0 opened 11 months ago

t0yv0 commented 11 months ago

What happened?

https://github.com/pulumi/pulumi-aws/issues/2880 triggers degenerate behavior with a single invocation p.tfServer.ValidateProviderConfig method taking as much as 10s greatly slowing down provider start-up time.

It appears that aws:endpoints parameter is a set of objects that gets very verbose representations as tftypes.Value and possibly triggers super-linear behavior somewhere in the dependencies. In particular github.com/hashicorp/terraform-plugin-go may be suboptimal here.

To workaround the immediate regression AWS provider will disable validations of the provider-level configuration over Plugin Framework, however this issue should remain open. It is yet unclear if the issue reproduces in pure Terraform, possibilities:

Please cross-link any more issues that manifest as very slow CheckConfig invocations on startup.

Example

See https://github.com/pulumi/pulumi-aws/issues/2880

Output of pulumi about

N/A

Additional context

N/A

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

mikhailshilkov commented 11 months ago

What is our plan beyond https://github.com/pulumi/pulumi-terraform-bridge/pull/1449?

t0yv0 commented 11 months ago

1449 to be done as soon as bridge is unblocked. I think this is worth cross-linking further issues before being prioritized for work. When working on this it's important to root cause the differential behavior vs Terraform, and that informs the fix, and helps file bugs upstream. The ideal outcome is terraform-plugin-go being fixed upstream to perform better. The less ideal outcome is us forking that codebase to fix the performance, or finding ways to interact with PF without terraform-plugin-go (harder).