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

Config Doesn't Work: Expects Project Name and Namespace #3223

Open
rawkode opened this issue Sep 13, 2019 · 7 comments
Open

Config Doesn't Work: Expects Project Name and Namespace #3223

rawkode opened this issue Sep 13, 2019 · 7 comments
Assignees
Labels
docs-feedback kind/enhancement Improvements or new features

Comments

@rawkode
Copy link
Contributor

rawkode commented Sep 13, 2019

Using Pulumi 1.1.0

Created a stack with pulumi stack init production --secrets-provider="gcpkms: ...
Selected stack with pulumi stack select production
Set some config with pulumi config set telegraf:version "1.12"

Pulumi.production.yaml looks like:

secretsprovider: gcpkms:...
encryptedkey: secret-key
config:
  telegraf:version: "1.12"

Inside my code, I have:

const data = {
  telegrafVersion: config.require("telegraf:version"),
}

Running a pulumi up responds with:

 pulumi up
Previewing update (production):

     Type                 Name                       Plan       Info
 +   pulumi:pulumi:Stack  devrel-metrics-production  create     1 error
 
Diagnostics:
  pulumi:pulumi:Stack (devrel-metrics-production):
    error: Missing required configuration variable 'devrel-metrics:telegraf:version'
        please set a value using the command `pulumi config set devrel-metrics:telegraf:version <value>`
@rawkode
Copy link
Contributor Author

rawkode commented Sep 13, 2019

NB: I did try the config set command with the project name too:

╰ pulumi config set devrel-metrics:telegraf:version "1.12"
error: invalid configuration key: could not parse devrel-metrics:telegraf:version as a configuration key (configuration keys should be of the form `<namespace>:<name>`)

@ellismg
Copy link
Contributor

ellismg commented Sep 13, 2019

I'm guessing that config here is a local which you have assigned to the result of new pulumi.Config(). The way the config system works is that values set as <namespace>:<name>. If you set a value on the command line that does not have a colon in it, then we assume it is in the namespace for your project (here that's devrel-metrics). Since there is a colon, we assume this value is in the telegraf namespace (similar to how if you set gcp:region we use gcp as the namespace and region as the key.

When constructing the Config object, if you don't pass a namespace, we use the current project as the namespace.

So in this case, you would want to do something like (new pulumi.Config("telegraf")).require("version");

@nesl247
Copy link
Contributor

nesl247 commented Sep 13, 2019

I think he forgot to close this out. It was already resolved in Slack.

@rawkode
Copy link
Contributor Author

rawkode commented Sep 13, 2019

Yeah. It wasn't clear to me that the namespace was the project name by default. Closing.

Thanks for your help

@rawkode rawkode closed this as completed Sep 13, 2019
@1tmb
Copy link

1tmb commented Oct 3, 2023

Would be great for https://www.pulumi.com/learn/building-with-pulumi/secrets/ to be expanded to explain this. Found this on a chance google after having the same problem as the OP. Cheers

@ericrudder
Copy link
Member

@interurban Want to take a look at the doc here?

@ericrudder ericrudder added this to the 0.95 milestone Oct 6, 2023
@mikhailshilkov mikhailshilkov removed this from the 0.95 milestone Oct 26, 2023
@justinvp justinvp added the kind/enhancement Improvements or new features label Nov 12, 2023
@RDavis3000
Copy link

2024 here, spent 2 hours trying to get this to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-feedback kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

9 participants