https://pulumi.com logo
Title
h

hundreds-monitor-95126

01/17/2020, 10:40 PM
Hey . I am very new to Pulumi and trying it for the 1st time. Really liked it though so far. I am trying to setup ‘aws secrets’ for my
pulumi typescript
project . But instead of exporting like below. I was hoping if i can manage aws key/secret in
.env
and provide it to pulumi config. I could not find any documentation for that.
export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID> && export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>
h

handsome-actor-1155

01/17/2020, 10:48 PM
I don’t think you’re able to use env variables. I know you can use the credentials file in ~/.aws/ or you can look at https://www.pulumi.com/docs/intro/cloud-providers/aws/#configuration for other options
👍 1
h

hundreds-monitor-95126

01/20/2020, 7:20 PM
Thanks this helps. I am reading it from
.env
file using
dotenv
package and then setting the provider
const config = new pulumi.Config(process.env.provider);

const providerOpts: pulumi.ComponentResourceOptions = {
  provider: new aws.Provider('prov', {
    region: <aws.Region>process.env.region,
    accessKey: process.env.accessKey,
    secretKey: process.env.secretKey,
  }),
};
Is there a way to set a default provider programmatically? It seems like i have to keep passing these provider values to every resource i am creating.