amazon-ebspulumi

Pulumi: Preview failed: 1 error occurred: * configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found


I have this issue where preview keeps failing when I try to run command to import a resource into an existing pulumi stack.

Here's the error

Type                    Name    Plan    Info
pulumi: pulumi: Stack   dev             1 error
- aws:ebs:Volume        id      import  1 error

Diagnostics:
pulumi:pulumi:Stack (dev):

error: Preview failed: 1 error occurred:
* configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
AWS Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, access disabled to EC2 IMDS via client option, or "AWS_EC2_ METADATA DISABLED" environment variable

Any ideas why this might be happening please?

I have run the import command on the cli to import an ebs volume, specifying the id of the resource. pulumi import aws:ebs/volume:Volume id vol-id and I am expecting a preview and some ts code that should be generated.

Here's what I expect

Previewing import (dev)

     Type                 Name        Plan
 +   pulumi:pulumi:Stack  dev         create
 =   └─ aws:ebs:Volume     id         import

Resources:
    + 1 to create
    = 1 to import
    2 changes

Do you want to perform this import?
> yes
  no
  details

Solution

  • This problem was finally fixed perhaps this might help someone out there in the future. The duration of my credentials had expired without my knowledge so I had to configure the AWS CLI to retrieve them automatically with this command

    aws configure sso
    

    as well as select the profile I needed to work with

    There’s more aws iam identity center credentials.

    Thanks to @dan1st as I was given a clue to what was actually happening.