Skip to content
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

return correct element types for latebound resources #664

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Bug Fixes-664.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component: runtime
kind: Bug Fixes
body: Fix potential panic when using fn::secret on a resource
time: 2024-10-14T17:31:02.140545881+02:00
custom:
PR: "664"
7 changes: 4 additions & 3 deletions pkg/pulumiyaml/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func (st *lateboundCustomResourceState) ProviderResource() *pulumi.ProviderResou
}

func (*lateboundCustomResourceState) ElementType() reflect.Type {
return reflect.TypeOf((*lateboundResource)(nil)).Elem()
return reflect.TypeOf((**lateboundCustomResourceState)(nil)).Elem()
}

func (st *lateboundCustomResourceState) GetRawOutputs() pulumi.Output {
Expand Down Expand Up @@ -625,7 +625,7 @@ func (st *lateboundProviderResourceState) ProviderResource() *pulumi.ProviderRes
}

func (*lateboundProviderResourceState) ElementType() reflect.Type {
return reflect.TypeOf((*lateboundResource)(nil)).Elem()
return reflect.TypeOf((**lateboundProviderResourceState)(nil)).Elem()
}

func (st *lateboundProviderResourceState) GetRawOutputs() pulumi.Output {
Expand Down Expand Up @@ -866,7 +866,8 @@ func (r *Runner) Evaluate(ctx *pulumi.Context) syntax.Diagnostics {
return r.Run(programEvaluator{
evalContext: eCtx,
pulumiCtx: ctx,
packageRefs: packageRefs})
packageRefs: packageRefs,
})
}

func getConfNodesFromMap(project string, configPropertyMap resource.PropertyMap) []configNode {
Expand Down
7 changes: 7 additions & 0 deletions pkg/tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,10 @@ func TestResourceOrderingWithDefaultProvider(t *testing.T) {
SkipEmptyPreviewUpdate: true,
})
}

//nolint:paralleltest // uses parallel programtest
func TestResourceSecret(t *testing.T) {
integration.ProgramTest(t, &integration.ProgramTestOptions{
Dir: filepath.Join("testdata", "resource-secret"),
})
}
15 changes: 15 additions & 0 deletions pkg/tests/testdata/resource-secret/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: resource-secret
runtime:
name: yaml
resources:
randomPassword:
type: random:RandomPassword
properties:
length: 16
lower: true
upper: true
numeric: true
special: true
outputs:
superSecret:
fn::secret: ${randomPassword}
Loading