-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[sdk-gen] Don't JSON-encode provider config #15032
base: master
Are you sure you want to change the base?
Conversation
Changelog[uncommitted] (2024-02-23)Bug Fixes
|
This is very tempting. Obviously feel like we must depend on it somewhere but if we don't that's a great change. QQ, when passing "variables" in Configure, they're still JSON-encoded and this PR does not affect that right? For bridged providers we've weaned off reading
|
It is handled in the engine, was changed all the way back in pulumi 1.1. |
Anything I can help with to unblock AWS tests? |
@t0yv0 no need, I expect things will be green after pulumi/pulumi-awsx#1201 goes in. The only other issues were a small type error in the dotnet fix and pulumi/pulumi-awsx#1198. |
This looks fantastic. Can we loop this through downstream bridged provider tests just in case to double-check that the bridge logic holds muster to parse these simpler config forms? |
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> |
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.
Why are we changing the target framework here?
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.
Probably a rebase side effect. This was bumped in #15373 and was rolled back when I ran PULUMI_ACCEPT=true make test_codegen_dotnet
. I'm also not sure why it added <PackageReference Include="Pulumi" Version="3.59.0" />
.
@EronWright brought up another interesting question on the strange Import(json=true) annotation in pulumi/pulumi-kubernetes#3020 From what I can tell, Java SDK appears to generate this https://github.com/pulumi/pulumi-java/blob/main/pkg/codegen/java/gen.go#L449 to json-encode Provider configuration arguments specifically for explicit providers. This I think is an instance of this same problem. |
@t0yv0 yeah, pulumi/pulumi-java#1308 covers the Java side. I'm almost inclined to suggest we start with Java (or a different language) if we don't have the appetite to change the behavior for everything at once. |
Description
Most of our SDKs (node, python, dotnet, java) send JSON-encoded provider configuration for legacy reasons, but YAML doesn't do this (example).
This behavior originated a long time ago when our providers only supported string properties, but of course this is no longer the case. Fortunately providers today accept both JSON or strongly typed configuration -- they attempt vanilla
plugin.UnmarshalProperties
but will fall back to JSON deserialization if that fails. This explains why YAML is able to send rich configuration without issue, and why it's safe to remove the legacy JSON serialization from other SDKs.The only exception is the newer go-provider, which doesn't handle non-primitive config from our SDKs (only from YAML pulumi/pulumi-go-provider#171) because it doesn't do any JSON unmarshalling. We could either:
This PR opts for (2) and removes JSON serialization from provider configs. pulumi/pulumi-java#1308 makes a similar change for java.
Fixes #12773
Fixes pulumi/pulumi-go-provider#171
Supersedes pulumi/pulumi-go-provider#172
Related pulumi/pulumi-java#1308
Related pulumi/pulumi-terraform-bridge#1610
Refs #13435
Refs #7058
Refs pulumi/pulumi-yaml#455
Refs pulumi/pulumi-docker#456
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt