https://pulumi.com logo
Title
h

helpful-account-44059

01/28/2022, 3:50 PM
Hi, is it possible to shared a global vpc in a project, for example, i will create a aws eks cluter and rds postgres server, they are in same vpc , how to organization the codes? do we have an example ?
e

echoing-dinner-19531

01/28/2022, 3:53 PM
I think the common recommendation for sharing resources is to set them up in a separate project and then use a stack reference to get their IDs and other outputs.
🙌 2
s

stale-vase-87890

01/28/2022, 3:54 PM
So I usually keep my VPC and default AWS account creation code separate from application infra code. Then if you need to pull the VPC info you can pull it from your stack state like this
const stateConfig = new pulumi.StackReference('myorg/myproject/my.dev')
then if you output your VPC id you can pull it in with stateConfig.output('myvpcid')
h

helpful-account-44059

01/28/2022, 4:00 PM
do you have any code repo that i can reference?
e

echoing-dinner-19531

01/28/2022, 4:05 PM