Hi, I am a newbie, who started learning Pulumi. I...
# getting-started
c
Hi, I am a newbie, who started learning Pulumi. I use DigitalOcean as my cloud provider. I have successfully created Droplets, Project spaces and moved a droplet into a project space, however I am stuck creating an equivalent of an S3 bucket (SpacesBucket). I googled for the error but I can't find a solution. I tried to set the ACCESS keys in pulumi as well as on the DO admin site but without success. Obviously, I am missing something, did somebody have a similar issue/error? Thank you 🙂 For the following code :
Copy code
import pulumi
import pulumi_digitalocean as digitalocean

foobar = digitalocean.SpacesBucket("foobarrandom615243", region="nyc3")
I get the following error:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (pulumispacecreate-dev):
    error: update failed
 
  digitalocean:index:SpacesBucket (foobarrandom615243):
    error: 1 error occurred:
        * Error creating bucket: Spaces credentials not configured
b
hey @cool-wall-66940! welcome! as per the docs, you need additional credentials to create a space bucket: https://www.pulumi.com/registry/packages/digitalocean/api-docs/spacesbucket/ You'll need to create a spaces access key from here: https://cloud.digitalocean.com/account/api/tokens Then set it in your provider like so:
Copy code
pulumi config set spaces_access_id <my access_id>
pulumi config set spaces_secret_key <my_secret_key> --secret
c
Hey @billowy-army-68599, thanks a lot for your warm welcoming and fast response. I tried to set spaces access keys with the following two variables:
Copy code
SPACES_ACCESS_KEY_ID SPACES_SECRET_ACCESS_KEY
then I tried with
Copy code
spaces_access_id
spaces_secret_key
I copied the two values starting with M and T, was I copying the wrong tokens? I tried with the commands above you wrote but I get the same error:
Copy code
Error creating bucket: Spaces credentials not configured
b
give me a few minutes, I'll try repro
1
l
Hello @cool-wall-66940, how did you set
spaces_access_id
and
spaces_secret_key
? These keys should prefixed with the
digitalocean
namespace:
Copy code
$ pulumi config set digitalocean:spaces_access_id <YOUR_ACCESS_KEY_HERE>
$ pulumi config set digitalocean:spaces_secret_key <YOUR_SECRET_KEY_HERE> --secret
1
c
Just as @billowy-army-68599 told me: I will try with your example as well @limited-rainbow-51650, btw. thanks a lot for your reply
b
yep, @limited-rainbow-51650 is right, I forgot to add the key prefix. your
Pulumi.dev.yaml
should look like this:
Copy code
config:
  digitalocean:spaces_access_id: FQFYFUXOEWEF7GYVUPPB
  digitalocean:spaces_secret_key:
    secure: AAABACcw7Bh1kmEVZwedBFXJkqudxX7PaHorF7FHDz3J76MFkA3D1N/pgRQKWfHlSQFUvN7LcJKJE7edpT7nJcUF2TdfrUIvE6ZT
which results in:
Copy code
Updating (dev)

View Live: <https://app.pulumi.com/jaxxstorm/spaces/dev/updates/1>

     Type                                Name        Status
 +   pulumi:pulumi:Stack                 spaces-dev  created
 +   └─ digitalocean:index:SpacesBucket  example     created

Resources:
    + 2 created

Duration: 33s
c
Hey @billowy-army-68599 and @limited-rainbow-51650, this did the trick, adding the namespace:
Copy code
digitalocean
in front of the variable names. This did the trick and it created the space. Let me try to do it with
Copy code
digitalocean:SPACES_ACCESS_KEY_ID
b
that won't work for the env vars
@cool-wall-66940 I've confirmed the env vars aren't working, that must be a bug in the provider
c
Ohh, ok, thanks a lot to both of you, for your help and for resolving this issue for me.
I hope our discussion will help somebody and the bug will be resolved. Thanks once again @billowy-army-68599 and @limited-rainbow-51650
b
l
@billowy-army-68599 it might also help other people if the section on
Configuring Credentials
is extended with Spaces specific settings https://www.pulumi.com/registry/packages/digitalocean/installation-configuration/#configuring-credentials
👍 1
b
agrred
👍 1
@cool-wall-66940 I just had it pointed out to me by @broad-dog-22463 that I had misspelled my env var, if I spell them correctly, it works as expected:
Copy code
export SPACES_ACCESS_KEY_ID=<key>
export SPACES_SECRET_ACCESS_KEY=<key>
👍 1
c
So let me try it, I will delete the two vars set earlier
Thanks. Just to confirm this works:
Copy code
export SPACES_ACCESS_KEY_ID=<key>
export SPACES_SECRET_ACCESS_KEY=<key>
this didn't work what I tried, and which was obviously wrong:
Copy code
pulumi config set SPACES_ACCESS_KEY_ID <key>
pulumi config set SPACES_SECRET_ACCESS_KEY <key>
❤️ 1
b
if anyone would be up for opening a pr for improving the credentials section, we would super appreciate it! https://github.com/pulumi/registry/edit/master/themes/default/content/registry/packages/digitalocean/installation-configuration.md