Hi, would someone mind pointing me in the right di...
# aws
b
Hi, would someone mind pointing me in the right direction: Using Python pulumi_aws, going really well, but I'm stuck on something: I'm trying to kick off a Cloudformation stack that uses
Outputs
from another stack, for example, this CFN stack has some EC2's with SGs:
Copy code
VpcId:
        Fn::ImportValue: !Sub '${Env}-vpc'
However, I'm unsure how to inject these into
cloudformation.Stack()
as it no longer nested
m
If you’re trying to replace what was once a cloudformation stack that set up the vpc and exported the vpc Id with a pulumi stack that sets up the vpc, then I think you have two choices: 1: change the dependent cloudformation stack to take the vpc as an input rather than importing it. 2. Replace the old vpc cloudformation stack with a new dummy cloudformation stack that takes the vpc is as input, then exports it so it can be imported by the other cloudformation stack.
b
^ thanks - I just started doing No.1 - didn't think about doing No.2! Thanks, going to look into No.2 right now.
m
If you do #2 you may need to make the dependent cloudformation stack explicitly dependent on the dummy cloudformation stack in pulumi, because the cf import is not derived from any pulumi output and hence pulumi won’t implicitly see the dependency
b
@many-garden-84306 doing the dummy stack works an absolute treat!!
Copy code
dummy_vpc = cloudformation.Stack(
    'DummyVpc',
    name=f'{Env}-vpc',
    parameters={
        'Env': Env,
        'VpcId': vpc.id,
        'VpcCidr': vpc.cidr_block,
        'SubnetPublic1': vpc_subnet_data['PublicSubnet1'],
        'SubnetPublic2': vpc_subnet_data['PublicSubnet2'],
        'SubnetPublic3': vpc_subnet_data['PublicSubnet3'],
        'SubnetPrivate1': vpc_subnet_data['PrivateSubnet1'],
        'SubnetPrivate2': vpc_subnet_data['PrivateSubnet2'],
        'SubnetPrivate3': vpc_subnet_data['PrivateSubnet3'],
        'SubnetPrivate1Cidr': vpc_subnet_data['SubnetPrivate1Cidr'],
        'SubnetPrivate2Cidr': vpc_subnet_data['SubnetPrivate2Cidr'],
        'SubnetPrivate3Cidr': vpc_subnet_data['SubnetPrivate3Cidr'],
        'VpcSecurityGroup': vpc.default_security_group_id
    },
    template_body=open('formations/vpc_dummy.yml').read(),
)
thank you! literally saved me hours banging my head against the table!
m
You're welcome!