Skip to content

Commit 8ec533b

Browse files
author
jslopes
committed
correção no tageamento para subnets
1 parent 8275399 commit 8ec533b

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

main.tf

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ resource "aws_subnet" "public" {
5858
{
5959
Name = lookup(var.subnet_public[count.index], "tag_name", null)
6060
},
61-
var.default_tags,
62-
var.tag_public
61+
lookup(var.subnet_public[count.index], "tag_public", null),
62+
var.default_tags
6363
)
6464
}
6565

@@ -141,8 +141,8 @@ resource "aws_subnet" "private" {
141141
{
142142
Name = lookup(var.subnet_private[count.index], "tag_name", null)
143143
},
144-
var.default_tags,
145-
var.tag_private
144+
lookup(var.subnet_private[count.index], "tag_private", null),
145+
var.default_tags
146146
)
147147
}
148148

@@ -470,3 +470,40 @@ resource "aws_vpc_peering_connection_accepter" "main" {
470470

471471
tags = var.default_tags
472472
}
473+
474+
## VPN
475+
476+
resource "aws_vpn_gateway" "main" {
477+
count = var.create ? length(var.vpn_customer_gateway) : 0
478+
479+
depends_on = [ aws_vpc.main ]
480+
481+
vpc_id = aws_vpc.main.0.id
482+
483+
tags = var.default_tags
484+
}
485+
486+
resource "aws_customer_gateway" "main" {
487+
count = var.create ? length(var.vpn_customer_gateway) : 0
488+
489+
depends_on = [ aws_vpc.main ]
490+
491+
bgp_asn = lookup(var.vpn_customer_gateway[count.index], "bgp_asn", null)
492+
ip_address = lookup(var.vpn_customer_gateway[count.index], "ip_address", null)
493+
type = lookup(var.vpn_customer_gateway[count.index], "type", null)
494+
495+
tags = var.default_tags
496+
}
497+
498+
resource "aws_vpn_connection" "main" {
499+
count = var.create ? length(var.vpn_customer_gateway) : 0
500+
501+
depends_on = [ aws_vpc.main, aws_customer_gateway.main, aws_vpn_gateway.main ]
502+
503+
vpn_gateway_id = aws_vpn_gateway.main.0.id
504+
customer_gateway_id = aws_customer_gateway.main.0.id
505+
type = lookup(var.vpn_customer_gateway[count.index], "type", null)
506+
static_routes_only = lookup(var.vpn_customer_gateway[count.index], "static_routes_only", null)
507+
508+
tags = var.default_tags
509+
}

variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ variable "vpc_peering_connection" {
8181
type = any
8282
default = []
8383
}
84+
variable "vpn_customer_gateway" {
85+
type = any
86+
default = []
87+
}

0 commit comments

Comments
 (0)