ashoksl
ashoksl

Reputation: 383

Pulumi import is throwing "Not authorized to perform this operation"

I'm trying to import existing vpc via pulumi.

const stackName = pulumi.getStack()
var vpcName = stackName + "-defaultvpc"

console.log("CIDR Block is" + config.cidrBlock)

const envVpc = new aws.ec2.Vpc(vpcName, {
    cidrBlock: config.cidrBlock,
}, {import: config.vpcId});

module.exports = {
    appVpc: envVpc
}

And then I'm executing pulumi up --stack test .

In my understanding this command just supposed to import the existing vpc into this test stack.

But during this execution, I'm getting the following error message.

error: Preview failed: refreshing urn:pulumi:test::identity::aws:ec2/vpc:Vpc::test-defaultvpc: UnauthorizedOperation: You are not authorized to perform this operation.

I've confirmed that I've all read permissions for the VPC in aws account. But unable to find out what is the exact permission pulumi requires for this operation.

Upvotes: 0

Views: 373

Answers (1)

Dan Hernandez
Dan Hernandez

Reputation: 21

This suggests you don't have authorization from AWS. From the command line where you're running pulumi, do you get the desired vpc in the results when running aws ec2 describe-vpcs?

If you do not, then you'll have to make sure that you have the DescribeVPC permission policy for that VPC.

Upvotes: 2

Related Questions