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

Structured configuration errors in Pulumi.yaml (which work in Pulumi.stack.yaml) #16056

Open
automagic opened this issue Apr 25, 2024 · 2 comments
Labels
area/config pulumi config kind/question Questions about existing features

Comments

@automagic
Copy link

automagic commented Apr 25, 2024

What happened?

When attempting to create a default config in Pulumi.yaml as follows:

config:
  foo:
    bar: foobar

we receive the following error:

error: could not validate '/Pulumi.yaml': 7 errors occurred:
        * #/config/foo: oneOf failed
        * #/config/foo: expected string, but got object
        * #/config/foo: expected integer, but got object
        * #/config/foo: expected boolean, but got object
        * #/config/foo: expected array, but got object
        * #/config/foo: doesn't validate with '/$defs/configTypeDeclaration'
        * #/config/foo: additionalProperties 'bar' not allowed

This same configuration declaration works fine in Pulumi.{stack}.yaml.

There is a workaround with an odd syntax:

config:
  foo:
    value:
      bar: foobar

But, typing of a key does not work either:

config:
  policies:
    type: array
    secret: false

Resulting in the following error:

error: could not unmarshal 'Pulumi.yaml': The configuration key 'policies' declares an array but does not specify the underlying type via the 'items' attribute

Example

see above

Output of pulumi about

3.113.3

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

@automagic automagic added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 25, 2024
@kindy
Copy link

kindy commented Apr 26, 2024

config in Pulumi.yaml is called project level configuration, and doc at concepts/config - Project Level Configuration
spec here concepts/projects/project-file/#config-options

I also been confused by the difference schema of project level & stack level configuration.

hope the doc can be more clear~~

@Frassle
Copy link
Member

Frassle commented Apr 26, 2024

I also been confused by the difference schema of project level & stack level configuration.

stack config is just values, project config is values and types/schema. That necessitates some changes in how they're written.

There is a workaround with an odd syntax:

We did consider making this syntax consistent and requiring it for simple values like strings/numbers as well but err'd on keeping simple values simple. We need this nesting under a "value" key for objects though so we can tell the difference between "here's just an object value" and "here's an object describing a schema".

But, typing of a key does not work either: ... Resulting in the following error:

I think that error's fairly clear? You need to set "items" to tell the system what the type of items in the array is.

@Frassle Frassle added kind/question Questions about existing features area/config pulumi config and removed kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config pulumi config kind/question Questions about existing features
Projects
None yet
Development

No branches or pull requests

3 participants