When attempting to get an existing VPC, either a new VPC gets created or types mismatch.
Expected Behavior
I should be able to get an existing VPC and use it in the plan as if it were created in that plan.
Steps to reproduce
name: catmeme-yaml
runtime: yaml
description: A reproducible test case
config:
sharedInfrastructureStackName:
type: string
variables:
vpcId: ${shared-infrastructure.outputs["vpcId"]}
resources:
shared-infrastructure:
type: pulumi:pulumi:StackReference
properties:
name: ${sharedInfrastructureStackName}
shared-vpc:
type: aws:ec2/vpc:Vpc
get:
# This fails as a stack reference
id: ${vpcId}
# id: vpc-07b89b6ab4bf305d1 # this "works" but creates a new VPC
appSecurityGroup:
type: aws:ec2/securityGroup:SecurityGroup
properties:
egress:
- fromPort: 0
toPort: 0
protocol: "-1"
cidrBlocks:
- "0.0.0.0/0"
vpcId: ${shared-vpc.id}
error: get.id must be a prompt string, instead got type pulumi.AnyOutput
on Pulumi.yaml line 41:
41: id: ${vpcId}
error: Error registering resource [shared-vpc]: no diagnostics
If I run pulumi convert, it shows re-declarations, and the id isn't used.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const sharedInfrastructureStackName = config.require("sharedInfrastructureStackName");
const sharedInfrastructure = new pulumi.StackReference("shared-infrastructure", {name: sharedInfrastructureStackName});
const vpcId = sharedInfrastructure.outputs.vpcId;
const sharedVpc = new aws.ec2.Vpc("shared-vpc", {});
const appSecurityGroup = new aws.ec2.SecurityGroup("appSecurityGroup", {
egress: [{
fromPort: 0,
toPort: 0,
protocol: "-1",
cidrBlocks: ["0.0.0.0/0"],
}],
vpcId: sharedVpc.id,
});
I have attempted to use the getVpc function as well, but I'm not sure how to integrate it with the other resources:
CLI
Version 3.66.0
Go Version go1.20.4
Go Compiler gc
Plugins
NAME VERSION
yaml unknown
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
What happened?
When attempting to get an existing VPC, either a new VPC gets created or types mismatch.
Expected Behavior
I should be able to get an existing VPC and use it in the plan as if it were created in that plan.
Steps to reproduce
If I run
pulumi convert
, it shows re-declarations, and the id isn't used.I have attempted to use the getVpc function as well, but I'm not sure how to integrate it with the other resources:
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).