pulumi / pulumi-mongodbatlas

A MongoDB Atlas Pulumi resource package, providing multi-language access to MongoDB Atlas
Apache License 2.0
16 stars 5 forks source link

Environment variables required even when pulumi config is setup #101

Closed brucemackenzie closed 2 years ago

brucemackenzie commented 2 years ago

Hello!

Issue details

Was trying to adopt an existing MongoDB project. Following directions here: https://www.pulumi.com/registry/packages/mongodbatlas/installation-configuration/

I was getting 401's when trying to import:

 error: Preview failed: refreshing urn:pulumi:mongo::mongo::mongodbatlas:index/project:Project::Center: 1 error occurred:
        * error getting project(<projectid>): GET https://cloud.mongodb.com/api/atlas/v1.0/groups/<projectid>: 401 (request "") You are not authorized for this resource.

Steps to reproduce

  1. Set the config values
    pulumi config set mongodbatlas:publicKey XXXXXXXXXXXXXX --secret 
    pulumi config set mongodbatlas:privateKey YYYYYYYYYYYYYY --secret
  2. Try to import Expected: success Actual: 401 error

When I did this:

export MONGODB_ATLAS_PUBLIC_KEY=XXXXXXXXXXXXXX 
export MONGODB_ATLAS_PRIVATE_KEY=YYYYYYYYYYYYYY

the import succeeded.

Remscar commented 2 years ago

Encountered this also, quite frustrating.