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
feat: Package Schema resource-typed properties #15795
base: master
Are you sure you want to change the base?
Conversation
Changelog[uncommitted] (2024-04-30)Features
|
130897d
to
fbf8cac
Compare
dc66e68
to
8cd0a87
Compare
I tested this feature branch (which also contains the unmarshaling fix) with the pulumi-kubernetes provider and it seems to work really well. Here's the patch that I applied: Then I updated my example (note the func signature in ApplyT now uses uid := example.Resources.Index(pulumi.Int(0)).ApplyT(func(r pulumi.Resource) pulumi.StringPtrOutput {
ctx.Log.Info("I'm a good ConfigMap", &pulumi.LogArgs{Resource: r})
configMap := r.(*corev1.ConfigMap)
return configMap.Metadata.Uid()
})
ctx.Export("configMapUid", uid) And the results were as-expected:
|
case anyResourceType: | ||
fallthrough | ||
return "pulumi:pulumi:Resource" |
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.
I think we need this block to be above the jsonType
, or jsonType
should stop leaning on fallthrough.
b0aa1ba
to
c20c3d1
Compare
A new built-in type, `pulumi.json#/Resource` is added to the schema to refer to any resource. This unblocks schematizing resources like `kubernetes.yaml/v2.ConfigFile`, which ideally would declare an output like so: ```json "properties": { "resources": { "type": "array", "items": { "$ref": "pulumi.json#/Resource" }, "description": "Resources created by the ConfigFile." } }, ``` This is a small ergonomic improvement over `pulumi.json#/Any`, and fixes #6346.
This moves more of the Resource type's implementation to the generated `types_builins.go`.
This PR unblocks the integration test below, which modified the Echo provider to pass-through its inputs to outputs - including resources. There remains a bug in re-marshaling a resource inside a provider that we avoid by simplifying `Create()` to pass-through. This is or is related to #15788.
Co-authored-by: Eron Wright <eron@pulumi.com>
c20c3d1
to
5c29970
Compare
A new built-in type,
pulumi.json#/Resource
is added to the schema to refer to any resource. This unblocks schematizing resources likekubernetes.yaml/v2.ConfigFile
, which ideally would declare an output like so:This is a small ergonomic improvement over
pulumi.json#/Any
, and fixes #6346.