Hey . I am very new to Pulumi and trying it for th...
# aws
h
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.
Copy code
export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID> && export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>
h
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
Thanks this helps. I am reading it from
.env
file using
dotenv
package and then setting the provider
Copy code
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.