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

Enable the l2-invoke-secrets test #683

Merged
merged 1 commit into from
Nov 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-683.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component: codegen
kind: Bug Fixes
body: Recognize the PCL fn::secret function
time: 2024-11-15T13:03:54.975607828Z
custom:
PR: "683"
1 change: 0 additions & 1 deletion cmd/pulumi-language-yaml/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ var expectedFailures = map[string]string{
"l2-invoke-options": "cannot assign expression",
"l2-map-keys": "missing expected dependency primitive",
"l2-provider-grpc-config-schema-secret": "Detected a secret leak in state",
"l2-invoke-secrets": "YAML does not support fn::secret",
"l2-parameterized-resource": "could not load schema for subpackage, provider not known",
"l2-failed-create-continue-on-error": "missing expected dependency fail_on_create",
"l2-invoke-dependencies": "missing expected dependency simple-invoke",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resources:
res:
type: simple:Resource
properties:
value: true
outputs:
# inputs are plain and the invoke response is plain
nonSecret:
fn::invoke:
Function: simple-invoke:secretInvoke
Arguments:
value: hello
secretResponse: false
Return: response
# referencing value from resource
# // invoke response is secret => whole output is secret
firstSecret:
fn::invoke:
Function: simple-invoke:secretInvoke
Arguments:
value: hello
secretResponse: ${res.value}
Return: response
# inputs are secret, invoke response is plain => whole output is secret
secondSecret:
fn::invoke:
Function: simple-invoke:secretInvoke
Arguments:
value:
fn::secret: goodbye
secretResponse: false
Return: response
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: l2-invoke-secrets
runtime: yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packageDeclarationVersion: 1
name: simple-invoke
version: 10.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packageDeclarationVersion: 1
name: simple
version: 2.0.0
2 changes: 2 additions & 0 deletions pkg/pulumiyaml/codegen/gen_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ func (g *generator) function(f *model.FunctionCallExpression) syn.Node {
return wrapFn("select", syn.List(args[1], args[0]))
case "readFile":
return wrapFn("readFile", g.expr(f.Args[0]))
case "secret":
return wrapFn("secret", g.expr(f.Args[0]))
case pcl.IntrinsicConvert:
// We can't perform the convert, but it might happen automatically.
// This works for enums, as well as number -> strings.
Expand Down
Loading