-
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
Quoted variable values incorrectly converted to integers #453
Comments
Another example of this happening. Have also tried:
Error:
Not sure if this is related? yaml/pyyaml#98 Update: ended up hardcoding it. |
Bump on this. It seems like it happens with booleans as well. Pulumi somehow converts things into a type. config:
biosys:ALLOW_PUBLIC_REGISTRATION: !!str 'True' Code: environment:
# https://www.pulumi.com/registry/packages/awsx/api-docs/ecs/fargatetaskdefinition/#taskdefinitionkeyvaluepair
- name: ALLOW_PUBLIC_REGISTRATION
value: !!str "${ALLOW_PUBLIC_REGISTRATION}" Error: aws:ecs:TaskDefinition (biosys-440-service):
error: aws:ecs/taskDefinition:TaskDefinition resource 'biosys-440-service' has a problem: ECS Task Definition container_definitions is invalid: Error decoding JSON: json: cannot unmarshal bool into Go struct field KeyValuePair.Environment.Value of type string. Examine values at 'TaskDefinition.ContainerDefinitions'. |
Seems like using this yaml syntax solves it biosys:ALLOW_PUBLIC_REGISTRATION: |-
"True" I found this out by using the |
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
Currently we're only passing the config as strings through the RunRequest method. This means that the program handling the RPC can't know the right types, and has to infer it. This leads to issues such as pulumi/pulumi-yaml#453. Passing the types through we'll be able to parse the strings correctly on the receiving end.
This now seems to be happening in reverse. I have values I want to be booleans, but they're being force converted into strings. |
pulumi seems to be converting all stack config values to strings. I want to store a boolean type there. Is there a way to store a value as a boolean, or to convert a string to a bool? I tried forcing it but didn't work. # Pulumi.develop.yaml
config:
myproject:myvar: false
# Pulumi.yaml
resources:
myresource:
options:
protect: ${pulumi.stack}.${myvar}
properties:
... The above gives an error
If I try to force it: options:
protect: !!bool ${pulumi.stack}.${myvar} It doesn't work:
I also tried passing it through the variables: section in Pulumi.yaml # Pulumi.yaml
...
variables:
varProtectTablesAsBool:
type: bool
value: ${pulumi.stack}.${protect_dynamodb_tables} # tried both with !!bool and without Still doesn't work, giving the first error |
I think protect is set to only accept a literal bool expression, not an interpolated expression. Some recent work in #510 to loosen this restriction for "version", probably doable for "protect" as well. |
What happened?
My Pulumi.develop.yaml file
When I attempt to use this value
aws_account_id
in the code, it strips the zero. The stripping doesn't happen to theaws:profile
. Perhaps because it contains some alpha characters too, or perhaps because the aws provider handles the variable differently.Someone on Slack (Scott Lowe) suggested:
I tried that, perhaps I'm missing something simple.
So this value
aws_account_id
is different for each stack hence its original location in the stack files i.e.Pulumi.develop.yaml
,Pulumi.staging.yaml
etc.I tried to implement your suggestion by adding a couple of lines under config: at the top of
Pulumi.yaml
like so:config:
Then I printed the output like so:
And it's still getting converted.
I also tried a slightly different way, but this just printed the variable name
Expected Behavior
I expected variable values entered with quotes to stay as strings
Steps to reproduce
This is where I tried to use it (in an IAM policy)
Output of
pulumi about
Additional context
Have tried double and single quotes, have tried
!!str '5432'
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: