-
Notifications
You must be signed in to change notification settings - Fork 1
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
Validate resources only during build time #37
Validate resources only during build time #37
Conversation
// InternalValidate should be called to validate the structure This is interesting.. Can you help me understand why this is called at runtime by us at all? Stack trace perhaps from the panic? |
helper/schema/runtime.go
Outdated
@@ -0,0 +1,31 @@ | |||
// Copied from https://github.com/pulumi/pulumi-terraform-bridge/blob/7c411fc807e709a85170cab0add5cb3a856c0c25/pkg/tfbridge/runtime.go#L1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really gnarly approach and I'm a little sad it's getting copied :) This for example does not detect unit test context properly. We don't have context.Context to propagate an option with but perhaps we could use a public global var that can be set by the unit test and TFGEN to enable the check.
Apart from the implementation nits I'm very eager to land this. |
Yeah, here is the full stack trace.
We call the tf provider's terraform-plugin-sdk/helper/schema/provider.go Lines 223 to 238 in ecba526
from It looks like the tf I'll change the PR to only call the |
I'll add a test for this behaviour in the bridge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good.
Is there a reason why we are also not skipping schemaMap(p.Schema).Validate(c)
on line (234)?
I believe that validates the config passed to the provider, which depends on runtime behaviour, so sounds useful |
Test added in pulumi/pulumi-terraform-bridge#1669, I'm going to merge this so I can get the right dependencies. |
…#1669) pick up pulumi/terraform-plugin-sdk#37 This also adds a test for the changes.
This is VERY unfortunate that their code calls InternalValidate which was intended for the static world of unit tests as part of validating the actual configuration data. |
I like how this change turned out. That is perfect. This internal validation should not be the default behavior. Thank you! |
…5137be (#3377) Should address #3330 This SHA is one beyond the last bridge upgrade and only pulls in pulumi/pulumi-terraform-bridge@6d1962d which pulls in pulumi/terraform-plugin-sdk#37 That should improve startup times in AWS by ~300ms This PR was generated via `$ upgrade-provider pulumi/pulumi-aws --kind=bridge --target-bridge-version=6d1962d8367a055a8859efa62118ec832e5137be --pr-reviewers=VenelinMartinov`. --- - Upgrading pulumi-terraform-bridge from v3.73.0 to 6d1962d8367a055a8859efa62118ec832e5137be. - Upgrading pulumi-terraform-bridge/pf from v0.26.0 to 6d1962d8367a055a8859efa62118ec832e5137be.
Should address pulumi/pulumi-aws#3330 after aws picks this up.
The resource validation runs the
SchemaFuncs
which is quite slow for some resources. This PR makes this run only during tfgen, to save time and memory during runtime.Tested in pulumi/pulumi-aws#3368 but I CI doesn't seem to run for some reason.