@@ -10,7 +10,7 @@ locals {
1010# #####
1111# VPC
1212# #####
13- resource "aws_vpc" "this " {
13+ resource "aws_vpc" "mod " {
1414 count = " ${ var . create_vpc ? 1 : 0 } "
1515
1616 cidr_block = " ${ var . cidr } "
@@ -42,7 +42,7 @@ resource "aws_vpc_dhcp_options" "this" {
4242resource "aws_vpc_dhcp_options_association" "this" {
4343 count = " ${ var . create_vpc && var . enable_dhcp_options ? 1 : 0 } "
4444
45- vpc_id = " ${ aws_vpc . this . id } "
45+ vpc_id = " ${ aws_vpc . mod . id } "
4646 dhcp_options_id = " ${ aws_vpc_dhcp_options . this . id } "
4747}
4848
@@ -52,7 +52,7 @@ resource "aws_vpc_dhcp_options_association" "this" {
5252resource "aws_internet_gateway" "this" {
5353 count = " ${ var . create_vpc && length (var. public_subnets ) > 0 ? 1 : 0 } "
5454
55- vpc_id = " ${ aws_vpc . this . id } "
55+ vpc_id = " ${ aws_vpc . mod . id } "
5656
5757 tags = " ${ merge (map (" Name" , format (" %s" , var. name )), var. igw_tags , var. tags )} "
5858}
@@ -63,7 +63,7 @@ resource "aws_internet_gateway" "this" {
6363resource "aws_route_table" "public" {
6464 count = " ${ var . create_vpc && length (var. public_subnets ) > 0 ? 1 : 0 } "
6565
66- vpc_id = " ${ aws_vpc . this . id } "
66+ vpc_id = " ${ aws_vpc . mod . id } "
6767
6868 tags = " ${ merge (map (" Name" , format (" %s-public" , var. name )), var. public_route_table_tags , var. tags )} "
6969}
@@ -87,7 +87,7 @@ resource "aws_route" "public_internet_gateway" {
8787resource "aws_route_table" "private" {
8888 count = " ${ var . create_vpc && local . max_subnet_length > 0 ? local . nat_gateway_count : 0 } "
8989
90- vpc_id = " ${ aws_vpc . this . id } "
90+ vpc_id = " ${ aws_vpc . mod . id } "
9191
9292 tags = " ${ merge (map (" Name" , (var. single_nat_gateway ? " ${ var . name } -private" : format (" %s-private-%s" , var. name , element (var. azs , count. index )))), var. private_route_table_tags , var. tags )} "
9393
@@ -104,7 +104,7 @@ resource "aws_route_table" "private" {
104104resource "aws_route_table" "intra" {
105105 count = " ${ var . create_vpc && length (var. intra_subnets ) > 0 ? 1 : 0 } "
106106
107- vpc_id = " ${ aws_vpc . this . id } "
107+ vpc_id = " ${ aws_vpc . mod . id } "
108108
109109 tags = " ${ merge (map (" Name" , " ${ var . name } -intra" ), var. intra_route_table_tags , var. tags )} "
110110}
@@ -115,7 +115,7 @@ resource "aws_route_table" "intra" {
115115resource "aws_subnet" "public" {
116116 count = " ${ var . create_vpc && length (var. public_subnets ) > 0 && (! var. one_nat_gateway_per_az || length (var. public_subnets ) >= length (var. azs )) ? length (var. public_subnets ) : 0 } "
117117
118- vpc_id = " ${ aws_vpc . this . id } "
118+ vpc_id = " ${ aws_vpc . mod . id } "
119119 cidr_block = " ${ var . public_subnets [count . index ]} "
120120 availability_zone = " ${ element (var. azs , count. index )} "
121121 map_public_ip_on_launch = " ${ var . map_public_ip_on_launch } "
@@ -129,7 +129,7 @@ resource "aws_subnet" "public" {
129129resource "aws_subnet" "private" {
130130 count = " ${ var . create_vpc && length (var. private_subnets ) > 0 ? length (var. private_subnets ) : 0 } "
131131
132- vpc_id = " ${ aws_vpc . this . id } "
132+ vpc_id = " ${ aws_vpc . mod . id } "
133133 cidr_block = " ${ var . private_subnets [count . index ]} "
134134 availability_zone = " ${ element (var. azs , count. index )} "
135135
@@ -142,7 +142,7 @@ resource "aws_subnet" "private" {
142142resource "aws_subnet" "database" {
143143 count = " ${ var . create_vpc && length (var. database_subnets ) > 0 ? length (var. database_subnets ) : 0 } "
144144
145- vpc_id = " ${ aws_vpc . this . id } "
145+ vpc_id = " ${ aws_vpc . mod . id } "
146146 cidr_block = " ${ var . database_subnets [count . index ]} "
147147 availability_zone = " ${ element (var. azs , count. index )} "
148148
@@ -165,7 +165,7 @@ resource "aws_db_subnet_group" "database" {
165165resource "aws_subnet" "redshift" {
166166 count = " ${ var . create_vpc && length (var. redshift_subnets ) > 0 ? length (var. redshift_subnets ) : 0 } "
167167
168- vpc_id = " ${ aws_vpc . this . id } "
168+ vpc_id = " ${ aws_vpc . mod . id } "
169169 cidr_block = " ${ var . redshift_subnets [count . index ]} "
170170 availability_zone = " ${ element (var. azs , count. index )} "
171171
@@ -188,7 +188,7 @@ resource "aws_redshift_subnet_group" "redshift" {
188188resource "aws_subnet" "elasticache" {
189189 count = " ${ var . create_vpc && length (var. elasticache_subnets ) > 0 ? length (var. elasticache_subnets ) : 0 } "
190190
191- vpc_id = " ${ aws_vpc . this . id } "
191+ vpc_id = " ${ aws_vpc . mod . id } "
192192 cidr_block = " ${ var . elasticache_subnets [count . index ]} "
193193 availability_zone = " ${ element (var. azs , count. index )} "
194194
@@ -209,7 +209,7 @@ resource "aws_elasticache_subnet_group" "elasticache" {
209209resource "aws_subnet" "intra" {
210210 count = " ${ var . create_vpc && length (var. intra_subnets ) > 0 ? length (var. intra_subnets ) : 0 } "
211211
212- vpc_id = " ${ aws_vpc . this . id } "
212+ vpc_id = " ${ aws_vpc . mod . id } "
213213 cidr_block = " ${ var . intra_subnets [count . index ]} "
214214 availability_zone = " ${ element (var. azs , count. index )} "
215215
@@ -274,7 +274,7 @@ data "aws_vpc_endpoint_service" "s3" {
274274resource "aws_vpc_endpoint" "s3" {
275275 count = " ${ var . create_vpc && var . enable_s3_endpoint ? 1 : 0 } "
276276
277- vpc_id = " ${ aws_vpc . this . id } "
277+ vpc_id = " ${ aws_vpc . mod . id } "
278278 service_name = " ${ data . aws_vpc_endpoint_service . s3 . service_name } "
279279}
280280
@@ -311,7 +311,7 @@ data "aws_vpc_endpoint_service" "dynamodb" {
311311resource "aws_vpc_endpoint" "dynamodb" {
312312 count = " ${ var . create_vpc && var . enable_dynamodb_endpoint ? 1 : 0 } "
313313
314- vpc_id = " ${ aws_vpc . this . id } "
314+ vpc_id = " ${ aws_vpc . mod . id } "
315315 service_name = " ${ data . aws_vpc_endpoint_service . dynamodb . service_name } "
316316}
317317
@@ -387,15 +387,15 @@ resource "aws_route_table_association" "public" {
387387resource "aws_vpn_gateway" "this" {
388388 count = " ${ var . create_vpc && var . enable_vpn_gateway ? 1 : 0 } "
389389
390- vpc_id = " ${ aws_vpc . this . id } "
390+ vpc_id = " ${ aws_vpc . mod . id } "
391391
392392 tags = " ${ merge (map (" Name" , format (" %s" , var. name )), var. vpn_gateway_tags , var. tags )} "
393393}
394394
395395resource "aws_vpn_gateway_attachment" "this" {
396396 count = " ${ var . vpn_gateway_id != " " ? 1 : 0 } "
397397
398- vpc_id = " ${ aws_vpc . this . id } "
398+ vpc_id = " ${ aws_vpc . mod . id } "
399399 vpn_gateway_id = " ${ var . vpn_gateway_id } "
400400}
401401
0 commit comments