Closed dongqiaoyang closed 1 year ago
Suspect config set
didn't respect the project type correctly, it should of seen the type was number and saved to the settings as a number not string.
@Frassle Current situation is that config set string like "123" gets automatically interpreted to integer by pulumi
Ah yeh sorry my bad, got the types the wrong way round but the essence is the same. The config save didn't check against the project settings.
@Frassle - curious, when you are referring to project settings, what do you mean by that ?
In the Pulumi.yaml:
configuration:
sha:
type: String
@Frassle , is it an expected behavior?
sha is expected to be a string and not integer.
How comes pulumi config set sha "123" not setting the type correctly?
Because the CLI doesn't see "123"
because of how shell quotes work. We just get the string 123
(not "123"
) and do a best guess that it's an integer. If we didn't do this then everything would be a string.
But we now have types in the project config, so now we can do better than the above. The CLI should look at the Pulumi.yaml see that sha
is of type string and then store it as a string even if the old logic goes "this looks like a number".
@Frassle the pulumi.yaml is already set up already as sha is type string, that was the original issue.
Will this be logged at a defect from Pulumi perspective and to be fixed?
Will this be logged at a defect from Pulumi perspective and to be fixed?
Yes I'm looking into this.
@Frassle It's important to note here that pathed values work differently from un-pathed values. pulumi config set sha[0] 123
generates a number.
some-program:sha:
- 123
I think we should work to align pathed and un-pathed behavior, but its helpful to know when they diverge.
@iwahbe yeh that would be ideal but I don't think that's actually the issue here. @dongqiaoyang I'm going to assume this is using a Pulumi yaml program given the error message and move this to that repo, I don't think this is an issue with the core engines handling of config.
@Frassle yes it is using pulumi yaml program. a
What happened?
The config value get automatically set as integer from string.
Pulumi version: v3.47.1
Input from CLI:
pulumi --non-interactive config set sha "123"
In the Pulumi.yaml:
configuration: sha: type: String
Error: pulumi:pulumi:Stack testing-testing running Error: config key sha cannot have conflicting types string, integer
Steps to reproduce
The config value get automatically set as integer from string.
Pulumi version: v3.48.0
Input from CLI:
pulumi --non-interactive config set sha "123"
In the Pulumi.yaml:
configuration: sha: type: String
Error: pulumi:pulumi:Stack testing-testing running Error: config key sha cannot have conflicting types string, integer
Expected Behavior
No config type error returned
Actual Behavior
Error: pulumi:pulumi:Stack testing-testing running Error: config key sha cannot have conflicting types string, integer
Output of
pulumi about
No response
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).