File tree Expand file tree Collapse file tree
terraform/data_replication Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,22 +39,23 @@ resource "aws_subnet" "public_subnet" {
3939}
4040
4141resource "aws_internet_gateway" "internet_gateway" {
42- count = min ( length (var . allowed_egress_cidr_blocks ), 1 )
42+ count = local . shared_egress_infrastructure_count
4343 vpc_id = aws_vpc. vpc . id
4444 tags = {
4545 Name = " data-replication-igw-${ var . environment } "
4646 }
4747}
4848
4949resource "aws_eip" "nat_ip" {
50+ count = local. shared_egress_infrastructure_count
5051 domain = " vpc"
5152 depends_on = [aws_internet_gateway . internet_gateway ]
5253}
5354
5455resource "aws_nat_gateway" "nat_gateway" {
55- count = min ( length (var . allowed_egress_cidr_blocks ), 1 )
56+ count = local . shared_egress_infrastructure_count
5657 subnet_id = aws_subnet. public_subnet . id
57- allocation_id = aws_eip. nat_ip . id
58+ allocation_id = aws_eip. nat_ip [ 0 ] . id
5859 connectivity_type = " public"
5960 depends_on = [aws_internet_gateway . internet_gateway ]
6061 tags = {
Original file line number Diff line number Diff line change @@ -82,8 +82,10 @@ variable "rails_master_key_path" {
8282}
8383
8484locals {
85- name_prefix = " mavis-${ var . environment } -data-replication"
86- subnet_list = [aws_subnet . subnet_a . id , aws_subnet . subnet_b . id ]
85+ name_prefix = " mavis-${ var . environment } -data-replication"
86+ subnet_list = [aws_subnet . subnet_a . id , aws_subnet . subnet_b . id ]
87+ shared_egress_infrastructure_count = min (length (var. allowed_egress_cidr_blocks ), 1 )
88+
8789 task_envs = [
8890 {
8991 name = " DB_HOST"
You can’t perform that action at this time.
0 commit comments