curved-country-30290
02/28/2023, 9:45 PMVpc.fromLookup
method. Anyone else bump into this problem?
I have an existing VPC that I want to use but Pulumi is erroring out and is instead using a placeholder VPC reference (vpc-12345)
Diagnostics:
aws:lb:TargetGroup (ServiceLBPublicListenerECSGroup0CC8688C):
error: 1 error occurred:
* creating LB Target Group: ValidationError: The VPC ID 'vpc-12345' is not found
status code: 400, request id: 5b58926c-338e-41e0-b0f8-10e7588ce64a
aws:ec2:SecurityGroup (ServiceSecurityGroupEEA09B68):
error: 1 error occurred:
* creating Security Group (ServiceSecurityGroupEEA09B68-b2c605f): InvalidVpcID.NotFound: The vpc ID 'vpc-12345' does not exist
status code: 400, request id: de44e778-78ef-4a97-bdfa-14a64a294ae0
aws:ec2:SecurityGroup (ServiceLBSecurityGroupF7435A5C):
error: 1 error occurred:
* creating Security Group (ServiceLBSecurityGroupF7435A5C-f054950): InvalidVpcID.NotFound: The vpc ID 'vpc-12345' does not exist
status code: 400, request id: 2260d61e-dfd3-4db4-9332-7110ce670c5c
pulumi:pulumi:Stack (pulumi-spike-demo):
error: update failed
Code:
class FargateStack extends pulumicdk.Stack {
clusterArn: pulumi.Output<string>;
serviceArn: pulumi.Output<string>;
constructor(id: string, options?: pulumicdk.StackOptions) {
super(id, options);
const vpc = ec2.Vpc.fromLookup(this, "VPC", {
vpcId: "vpc-000000aaaaaab",
});
const service = new ecsPatterns.ApplicationLoadBalancedFargateService(
this,
"Service",
{
vpc,
cpu: 512,
memoryLimitMiB: 1024,
desiredCount: 1,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry(
"amazon/amazon-ecs-sample"
),
},
}
);
this.clusterArn = this.asOutput(service.cluster.clusterArn);
this.serviceArn = this.asOutput(service.service.serviceArn);
this.synth();
}
}
new FargateStack("FargateStack", {
props: {
env: {
region: "us-west-2",
account: "1234567890",
},
},
});
miniature-musician-31262
03/06/2023, 2:51 PMvpc-12345
tacked onto the end.ApplicationLoadBalancedFargateService
needs a CDK IVpc
. Curious what you came up with, if anything!curved-country-30290
03/06/2023, 4:35 PMcdk.context.json
that it generated to the Pulumi project and it didn't work so something must be preventing these context lookups.
But as a workaround, the fromVpcAttributes
works but it's not nearly as convenient as fromLookup
. I also suspect that other modules that have their own fromLookup
method might fail for the same reasons