I am creating an (AWS Copilot) addon (inside the environments folder) which has the following piece of script creating a security group:
SGPostgresDb:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: sg-pgdb
GroupDescription: Allows only postgres traffic
VpcId: !Ref ?????????
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 5432
ToPort: 5432
CidrIp: 0.0.0.0/0
But I need to somehow refer to the VPC ID. How could I go about it?
In general, how can I refer to the elements specified inside the manifest.yml? Besides the VPC, the copilot creates internet gateway, subnets, route table...., so when we create additional resources inside an addon file we might need to refer to VPC or a subnet created by the copilot by copilot env deploy command. How can we refer to those elements too?
@fade2black! Those environment resources are all
Outputsof your environment's CloudFormation stack. So other stacks, including workload addons, and manifests can reference them.See more here and here!