gorgeous-pharmacist-71907
03/12/2024, 5:22 PMpulumi import
command with was resources?
i'm trying to import an aws vpc but getting resource doesn't exist so think i might be missing something..miniature-musician-31262
03/12/2024, 5:24 PMgorgeous-pharmacist-71907
03/12/2024, 5:27 PMpulumi import 'aws:ec2/vpc:Vpc' existing-vpc {vpc-id}]
gorgeous-pharmacist-71907
03/12/2024, 5:27 PMpulumi import
commandminiature-musician-31262
03/12/2024, 5:30 PMAWS_REGION=us-west-2 pulumi import...
gorgeous-pharmacist-71907
03/12/2024, 5:31 PMAWS_REGION=eu-west-1 pulumi import aws:ec2/vpc:Vpc "existing-vpc" "vpc-07db480a0387735f0"
gorgeous-pharmacist-71907
03/12/2024, 5:31 PMgorgeous-pharmacist-71907
03/12/2024, 5:33 PMpulumi config get aws:profile
it confirms that im using the right profile that has accessminiature-musician-31262
03/12/2024, 5:36 PMaws:profile
and that's it for the AWS configuration?gorgeous-pharmacist-71907
03/12/2024, 5:38 PMgorgeous-pharmacist-71907
03/12/2024, 5:38 PMgorgeous-pharmacist-71907
03/12/2024, 5:38 PMminiature-musician-31262
03/12/2024, 5:39 PMAWS_PROFILE=your_profile pulumi import..
gorgeous-pharmacist-71907
03/12/2024, 5:42 PMminiature-musician-31262
03/12/2024, 5:43 PMgorgeous-pharmacist-71907
03/12/2024, 5:52 PMminiature-musician-31262
03/12/2024, 5:57 PMminiature-musician-31262
03/12/2024, 5:58 PMaws ec2 describe-vpcs
?gorgeous-pharmacist-71907
03/12/2024, 5:59 PMgorgeous-pharmacist-71907
03/12/2024, 5:59 PMgorgeous-pharmacist-71907
03/12/2024, 5:59 PMgorgeous-pharmacist-71907
03/12/2024, 5:59 PMminiature-musician-31262
03/12/2024, 6:57 PMnew aws.Provider()
, or just use the "ambient" (default) one?miniature-musician-31262
03/12/2024, 6:59 PMminiature-musician-31262
03/12/2024, 7:00 PMminiature-musician-31262
03/12/2024, 8:12 PMPulumi.dev.yaml
file (the whole thing):
config:
aws:profile: nunciato
Made sure no ambient AWS credentials:
$ env | grep AWS
$
Using the CLI to list VPCs with a different profile:
$ AWS_PROFILE=pulumibook aws ec2 describe-vpcs | grep vpc-4de78c35
"VpcId": "vpc-4de78c35",
Attempting to import that VPC with pulumi import
(fails with "does not exist", because the profile in the config file is nunciato
):
$ pulumi import "aws:ec2/vpc:Vpc" "my-vpc" "vpc-4de78c35"
...
Diagnostics:
pulumi:pulumi:Stack (aws-typescript-8042d86-dev):
error: preview failed
aws:ec2:Vpc (my-vpc):
error: Preview failed: resource 'vpc-4de78c35' does not exist
After changing the aws:profile
in Pulumi.dev.yaml
to `pulumibook`:
$ pulumi import "aws:ec2/vpc:Vpc" "my-vpc" "vpc-4de78c35"
...
ā aws-typescript-8042d86 pulumi import "aws:ec2/vpc:Vpc" "my-vpc" "vpc-4de78c35"
Previewing import (dev)
Type Name Plan
+ pulumi:pulumi:Stack aws-typescript-8042d86-dev create
= āā aws:ec2:Vpc my-vpc import
Resources:
+ 1 to create
= 1 to import
2 changes
Do you want to perform this import? [Use arrows to move, type to filter]
yes
> no
details
miniature-musician-31262
03/12/2024, 8:19 PM[pulumibook]
in ~/.aws/credentials
using credentials for a different account -- i.e., known-good creds, just not the creds that correspond with the account the VPC lives in.
Even when I set AWS_*
environment variables, it still works, which tells me aws:profile
is taking precedence.miniature-musician-31262
03/12/2024, 8:27 PMus-west-2
to something else, I do indeed get the "does not exist":
[profile pulumibook]
region = us-east-1
output = json
miniature-musician-31262
03/12/2024, 8:29 PMus-west-2
and then run AWS_REGION=us-east-1 pulumi import...
, I get "does not exist" as well. So I think you may be right that the region is the issue here.miniature-musician-31262
03/12/2024, 8:29 PMAWS_REGION
as an environment variable. That seems like the most likely culprit right now.gorgeous-pharmacist-71907
03/12/2024, 9:35 PMshared
directory:
shared:
ā¢ resources
ā¦ ecr
ā¢ Pulumi.yaml
ā¢ Pulumi.shared.yaml
fyi I've just put {} placeholders to omit the values
# pulumi.yaml
name: shared
runtime: nodejs
description: Shared infrastructure that can be used in other stacks
organization: {}
backend:
url: {s3-state}
config:
aws:profile: {pulumi-profile}
aws:region: eu-west-1
And then
# pulumi.shared.yaml
encryptionsalt: {salt}
I've confirmed that when I run pulumi config get aws:region
and pulumi config get aws:profile
, it gives me the values in Pulumi.yaml
and when I run env | grep AWS
, there's no region set there
ive double checked the ~/.aws/credentials
and i have the profile
# ~/.aws/credentials
[pulumi-profile]
[livelink-ai-pulumi-infra]
region = eu-west-1
aws_access_key_id = {}
aws_secret_access_key = {}
so even in the profile ive specified the desired region, but yeah based on your testing, aws:profile
overrides so in theory that shouldn't make a differencegorgeous-pharmacist-71907
03/12/2024, 9:35 PMgorgeous-pharmacist-71907
03/13/2024, 1:19 PM