File tree 4 files changed +27
-14
lines changed
4 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 14
14
15
15
resource "aws_eip" "mod_nat" {
16
16
count = var. multi_az_nat_gateway * var. az_count + var. single_nat_gateway * 1
17
- tags = var. global_tags
17
+ tags = var. global_tags
18
18
vpc = true
19
19
}
20
20
Original file line number Diff line number Diff line change @@ -79,18 +79,26 @@ variable "extra_tags_private_subnet" {
79
79
default = {}
80
80
}
81
81
82
+ # # Tagging Settings
83
+ variable "elastic_ip_name_prefix" {
84
+ type = string
85
+ description = " The name prefix for each eip."
86
+ default = " "
87
+ }
88
+
82
89
# Local Vars
83
90
locals {
91
+ eip_name_prefix = length (var. elastic_ip_name_prefix ) > 0 ? " ${ var . elastic_ip_name_prefix } -" : " "
84
92
default_tags = {
85
93
" ManagedVia" = " Terraform"
86
94
" Author" = " Fairwinds"
87
95
}
88
96
89
- tags = merge (local. default_tags , var. extra_tags_global )
90
- admin_subnet_tags = merge (local. tags , var. extra_tags_admin_subnet )
97
+ tags = merge (local. default_tags , var. extra_tags_global )
98
+ admin_subnet_tags = merge (local. tags , var. extra_tags_admin_subnet )
91
99
private_subnet_tags = merge (local. tags , var. extra_tags_private_subnet )
92
- public_subnet_tags = merge (local. tags , var. extra_tags_public_subnet )
93
- avail_zones_list = split (" ," , var. availability_zones )
100
+ public_subnet_tags = merge (local. tags , var. extra_tags_public_subnet )
101
+ avail_zones_list = split (" ," , var. availability_zones )
94
102
}
95
103
96
104
# Usage validation
Original file line number Diff line number Diff line change @@ -59,8 +59,13 @@ resource "aws_nat_gateway" "nat_gateway" {
59
59
60
60
resource "aws_eip" "mod_nat" {
61
61
count = length (local. avail_zones_list )
62
- tags = local. tags
63
- vpc = true
62
+ tags = merge (
63
+ local. tags ,
64
+ {
65
+ " Name" = " ${ local . eip_name_prefix } ${ var . vpc_name } _${ local . avail_zones_list [count . index ]} "
66
+ },
67
+ )
68
+ vpc = true
64
69
}
65
70
66
71
output "aws_eip_nat_ips" {
Original file line number Diff line number Diff line change @@ -165,30 +165,30 @@ POLICY
165
165
166
166
variable "s3_vpc_endpoint_route_table_ids" {
167
167
description = " By default routes to the s3 endpoint are added for private subnet route tables. Pass additional route table ids that require routes."
168
- type = list (string )
169
- default = []
168
+ type = list (string )
169
+ default = []
170
170
}
171
171
172
172
variable "internet_gateway_tags" {
173
173
description = " Tags to apply to the internet gateway"
174
- default = {}
174
+ default = {}
175
175
}
176
176
177
177
variable "public_route_table_tags" {
178
178
description = " Tags to apply to the public route table"
179
- default = {}
179
+ default = {}
180
180
}
181
181
182
182
variable "private_route_table_tags" {
183
183
description = " Tags to apply to the private route table"
184
- default = {}
184
+ default = {}
185
185
}
186
186
187
187
variable "global_tags" {
188
188
description = " AWS tags that will be added to all resources managed herein"
189
- type = map (string )
189
+ type = map (string )
190
190
default = {
191
- " Author" = " Fairwinds"
191
+ " Author" = " Fairwinds"
192
192
" Managed By" = " Terraform"
193
193
}
194
194
}
You can’t perform that action at this time.
0 commit comments