Reputation: 345
I have created a stack for our Multi-AZ RDS setup within same region. The stack creates VPC, Subnets, IGW, Route Tables, SecGroups, EC2, RDS EC2 etc and currently about 200+ lines.
I was not aware of Export Parameter
and Fn::ImportValue
where we can do the cross-stack reference. I have also just learned that a stack can't be deleted if it has Exported some of its parameters and other stack are referencing it.
My question to CloudFormation experts is it more practical/professional to keep one Stack (so deletion of all the resources is easy) OR should we split our IAC into multiple inter-related stacks?
Appreciate your input as I have prepared this template for a Demo that I am giving to my team, either I should leave it as it is or split it up.
Created one Stack that setup the infrastructure and also create all the resources in one-go.
Upvotes: 4
Views: 1056
Reputation: 345
Thanks, I have splitted into two stacks, first is the core-infrastructure
that only creates network Skelton i.e VPC, IGW, Subnets, Routes. This stack emits output parameters with each of these resources's export names.
The second stack rds-resources
just reference above and create EC2, RDS, SG.
Thanks again for the useful information.
Upvotes: 1
Reputation: 4987
There are probably many correct answers, therefore I would try to help you narrow down the one that would be best for you.
I hope this helped you come up to a decision. If not, share more information.
Upvotes: 1