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

StackSettingsConfigValueYamlConverter does not support arrays #11107

Closed
ffMathy opened this issue Oct 21, 2022 · 1 comment · Fixed by #11143
Closed

StackSettingsConfigValueYamlConverter does not support arrays #11107

ffMathy opened this issue Oct 21, 2022 · 1 comment · Fixed by #11143
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@ffMathy
Copy link
Contributor

ffMathy commented Oct 21, 2022

What happened?

I am trying to create a LocalWorkspace and use the settings from another existing Pulumi.stack.yaml file into this local workspace.

However, one of the settings has an array value. And when the LocalWorkspace then tries to deserialize that value, it fails because the StackSettingsConfigValueYamlConverter throws an exception if an array is encountered. It should be gracefully ignored.

Steps to reproduce

var iacWorkspace = await LocalWorkspace.CreateAsync(
    new InlineProgramArgs(
        "some-project-name",
        "some-stack",
        pulumiStack)
    {
        WorkDir = someProjectPath
    },
    cancellationToken);

var settings = await iacWorkspace.GetStackSettingsAsync("some-stack", cancellationToken);
//throws exception

With the following stack config:

config:
  aws:allowedAccountIds:
  - 1337

Expected Behavior

The array value is skipped during deserialization.

Actual Behavior

Unable to deserialize [Pulumi.Automation.StackSettingsConfigValue]. Expecting object if not plain string.

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).

@ffMathy ffMathy added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 21, 2022
@Zaid-Ajaj
Copy link
Contributor

Hi @ffMathy thanks a lot for filing the issue! I've been able to reproduce the problem and it was indeed far from ideal to throw an exception. I think that gracefully ignoring the value isn't enough as a solution so I've opened #11143 where we will JSON-ify the contents of the complex objects into the value of StackSettingsConfigValue so consumers can still access it.

@Zaid-Ajaj Zaid-Ajaj removed the needs-triage Needs attention from the triage team label Oct 25, 2022
bors bot added a commit that referenced this issue Oct 26, 2022
11143: [dotnet/auto] allow deserializing complex stack config values r=Zaid-Ajaj a=Zaid-Ajaj

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes #11107 now instead of failing, we JSON-ify the complex stack config value 

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com>
@bors bors bot closed this as completed in 159988d Oct 26, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Oct 26, 2022
abhinav pushed a commit to pulumi/pulumi-dotnet that referenced this issue Jan 11, 2023
11143: [dotnet/auto] allow deserializing complex stack config values r=Zaid-Ajaj a=Zaid-Ajaj

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes pulumi/pulumi#11107 now instead of failing, we JSON-ify the complex stack config value 

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants