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

Update pulumi-yaml to recognize the new core config block #369

Closed
Tracked by #269
Frassle opened this issue Oct 17, 2022 · 5 comments · Fixed by #379
Closed
Tracked by #269

Update pulumi-yaml to recognize the new core config block #369

Frassle opened this issue Oct 17, 2022 · 5 comments · Fixed by #379
Assignees
Labels
area/config kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@Frassle
Copy link
Member

Frassle commented Oct 17, 2022

pulumi/pulumi#10832 adds a new core config block to Pulumi.yaml that the engine understands as defining project config. We should update pulumi-yaml to recognize and use that block rather than defining it's own "configuration" block.


As YAML is a language host using the Go SDK, it should rely on on the Go SDK config package (GetConfig and IsConfigSecret) to derive configuration keys, and use the structure of the values to infer their types, leaving validation up to the engine. If that's not possible, we should should use shared code from the engine to parse the type and items fields.

As a consequence of using GetConfig, it may not be possible to statically analyze a Pulumi program absent a stack file to determine if the a key is defined. We may want an enhancement to the Go SDK's config package to allow us to query for the existence of a key or for static analysis to rely on the engine's parsing of the project file to be consistent.

As this would be a breaking change for configuration declarations; we should support the old key with a warning to avoid breaking users prior to GA.

@Frassle Frassle added kind/enhancement Improvements or new features area/config labels Oct 17, 2022
@Frassle Frassle added this to the 0.80 milestone Oct 17, 2022
@Frassle
Copy link
Member Author

Frassle commented Oct 18, 2022

Well pretty much immediately hit an issue that yaml has "secret: true" flags for config variables, and the current MVP doesn't have any support for secrets at project level.

I think we could add "secret" to the core block, but it's a bit odd if we allow default to be set with (because the value can't actually be encrypted in Pulumi.yaml yet). It looks like YAML allows this:

  buzz:
    default: 42
    secret: true

So I guess we would also have to allow this for now? Bit lame but looks like we'll have to.

@AaronFriel any input?

@AaronFriel
Copy link
Member

As I think I've shared, I'd like YAML to consume PULUMI_CONFIG and PULUMI_CONFIG_SECRET_KEYS env vars rather than parse the config block (reducing the # of special keys YAML adds to project files) as do other language hosts.

If we support secret: true, with the effect of adding it to PULUMI_CONFIG_SECRET_KEYS, that should do it? And I think it actually makes sense to do so as well:

config:
  # Each stack config must specify this, and it must be secret:
  superSecretPerEnvironmentToken:
    secret: true

I think these would be useful, but not high priority follow up features:

  1. Use that project level annotation to warn/error when the stack config is not secret.
  2. Use that project level annotation to have the effect of an implicit "--secret" flag on pulumi config set superSecretPerEnvironmentToken

@Frassle
Copy link
Member Author

Frassle commented Oct 19, 2022

env vars rather than parse the config block

And just use the implicit typing from the values of those JSON blobs? I thought YAML needed extra type information?

And I think it actually makes sense to do so as well:

Yeh I think it makes sense to add this, I think checking that stack values are secret if it's set and automatically adding "--secret" all make sense, my only question was how we'd want to deal with setting secret and default together. Long term I think that'll make sense as well because we'll have project level secrets, but for now do we just allow it and assume the default value isn't actually that secret?

@Frassle
Copy link
Member Author

Frassle commented Oct 19, 2022

I've raised pulumi/pulumi#11084 to add "secret" which ensures that if the stack has that config key that it is an encrypted value.

We're currently not doing any project level support in pulumi config, but I think adding an implicit --secret for these keys will make sense when we do.

@AaronFriel
Copy link
Member

We ought to be able to recover the type info by inspecting the structure of the JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants