-
Notifications
You must be signed in to change notification settings - Fork 12
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
Using secret path breaks pulumi up #434
Comments
This is a current limitation of config with the yaml runtime. It doesn't support objects, I think the following config should work:
|
I'm having the exact same symptom when running a YAML program with the |
I have a workaround for For @fuadsaud using config:
awsRoleArn:
type: string
secret: true
resources:
awsProvider:
type: pulumi:providers:aws
properties:
assumeRole:
roleArn: ${awsRoleArn}
defaultProvider: true
# options:
# # if you would like to pin to an AWS version
# version: Then run: pulumi config set --secret awsRoleArn foobar The default provider will then be used for all resources in your program. The default provider configured in this way only takes configuration via environment variable ( # In the stack config file
config:
aws:foo: "bar" You will want to pass them into the explicit provider like so: resources:
awsProvider:
type: pulumi:providers:aws
properties:
foo: ${aws:foo} |
The type checker is modified to make property access on 'Any' return 'Any', which enables workarounds for #434 using programs like below. Unblocking this sans workaround will require further implementation of these issues to support more complex structured, hierarchical config: - pulumi/pulumi#1052 - pulumi/pulumi#2307 The workaround program is: ```yaml name: tmp.0T7TLEvBj8 runtime: yaml description: A minimal Pulumi YAML program variables: myObject: fn::secret: fn::std:jsondecode: input: fn::fromBase64: ${myJSON} outputs: test: ${myObject.result.test.password} ``` In this workaround we: 1. Base64 encode the JSON object we want to use in Pulumi YAML. This is necessary because Pulumi will attempt to JSON decode the value of config variables into objects on our behalf. ```sh pulumi config set --secret \ myJSON \ $(printf '{ "test": { "password": "secretpassword123" } }' | base64) ``` 2. Use `fn::fromBase64` to decode that string into its original value. 3. Use `fn::std:jsondecode` to convert that string to an object. 4. Use `fn::secret` to ensure the value is marked as a secret. (Experimentally, this was necessary.) The code change in the analyzer is necessary to allow indexing into the `Any` type on `${myObject.result}`.
A partial fix for Pulumi YAML unblocking a workaround for @istvan-fodor has been posted here: Sorry that this isn't an ideal solution @istvan-fodor, definitely something we need to improve upon. |
The type checker is modified to make property access on 'Any' return 'Any', which enables workarounds for #434 using programs like below. Unblocking this sans workaround will require further implementation of these issues to support more complex structured, hierarchical config: - pulumi/pulumi#1052 - pulumi/pulumi#2307 The workaround program is: ```yaml name: tmp.0T7TLEvBj8 runtime: yaml description: A minimal Pulumi YAML program variables: myObject: fn::secret: fn::std:jsondecode: input: fn::fromBase64: ${myJSON} outputs: test: ${myObject.result.test.password} ``` In this workaround we: 1. Base64 encode the JSON object we want to use in Pulumi YAML. This is necessary because Pulumi will attempt to JSON decode the value of config variables into objects on our behalf. ```sh pulumi config set --secret \ myJSON \ $(printf '{ "test": { "password": "secretpassword123" } }' | base64) ``` 2. Use `fn::fromBase64` to decode that string into its original value. 3. Use `fn::std:jsondecode` to convert that string to an object. 4. Use `fn::secret` to ensure the value is marked as a secret. (Experimentally, this was necessary.) The code change in the analyzer is necessary to allow indexing into the `Any` type on `${myObject.result}`.
The type checker is modified to make property access on 'Any' return 'Any', which enables workarounds for #434 using programs like below. Unblocking this sans workaround will require further implementation of these issues to support more complex structured, hierarchical config: - pulumi/pulumi#1052 - pulumi/pulumi#2307 The workaround program is: ```yaml name: tmp.0T7TLEvBj8 runtime: yaml description: A minimal Pulumi YAML program variables: myObject: fn::secret: fn::std:jsondecode: input: fn::fromBase64: ${myJSON} outputs: test: ${myObject.result.test.password} ``` In this workaround we: 1. Base64 encode the JSON object we want to use in Pulumi YAML. This is necessary because Pulumi will attempt to JSON decode the value of config variables into objects on our behalf. ```sh pulumi config set --secret \ myJSON \ $(printf '{ "test": { "password": "secretpassword123" } }' | base64) ``` 2. Use `fn::fromBase64` to decode that string into its original value. 3. Use `fn::std:jsondecode` to convert that string to an object. 4. Use `fn::secret` to ensure the value is marked as a secret. (Experimentally, this was necessary.) The code change in the analyzer is necessary to allow indexing into the `Any` type on `${myObject.result}`.
The type checker is modified to make property access on 'Any' return 'Any', which enables workarounds for #434 using programs like below. Unblocking this sans workaround will require further implementation of these issues to support more complex structured, hierarchical config: - pulumi/pulumi#1052 - pulumi/pulumi#2307 The workaround program is: ```yaml name: tmp.0T7TLEvBj8 runtime: yaml description: A minimal Pulumi YAML program variables: myObject: fn::secret: fn::std:jsondecode: input: fn::fromBase64: ${myJSON} outputs: test: ${myObject.result.test.password} ``` In this workaround we: 1. Base64 encode the JSON object we want to use in Pulumi YAML. This is necessary because Pulumi will attempt to JSON decode the value of config variables into objects on our behalf. ```sh pulumi config set --secret \ myJSON \ $(printf '{ "test": { "password": "secretpassword123" } }' | base64) ``` 2. Use `fn::fromBase64` to decode that string into its original value. 3. Use `fn::std:jsondecode` to convert that string to an object. 4. Use `fn::secret` to ensure the value is marked as a secret. (Experimentally, this was necessary.) The code change in the analyzer is necessary to allow indexing into the `Any` type on `${myObject.result}`.
What happened?
I created a new project from the yaml template (no code at all, just config files) and set a secret value using the following command:
pulumi config set --path 'my.test.password' secretpassword123 --secret
The resulting config file looks like this:
When I try to run a
pulumi up
, I get the following error:Steps to reproduce
pulumi config set --path 'my.test.password' secretpassword123 --secret
pulumi up
Expected Behavior
pulumi up
would run without error.Actual Behavior
Got error on
pulumi up
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: