I have come across an unusual issue when using terraform v0.12.20 and tags in aws_vpn_connection
- this is not an error, more an emission.
resource aws_vpn_connection
is configured for a transit_gateway_id
connection. The VPN connection is successfully created and tagged.
The resource aws_vpn_connection
is also managing the attachment of the VPN connection to the Transit Gateway “under the hood”. This also completes without error.
The issue I have is that the vpn connection Transit Gateway Attachment cannot be tagged.
It seam that resource aws_vpn_connection
creates 2 resources but only tags 1.
site-to-site VPN Connection is tagged
VPN Transit Gateway attachment cannot be tagged
Here is my code:
resource "aws_vpn_connection" "vpn_connections" {
for_each = var.vpn_config
customer_gateway_id = aws_customer_gateway.customer_gateways[each.key].id
transit_gateway_id = aws_ec2_transit_gateway.tgw.id
type = aws_customer_gateway.customer_gateways[each.key].type
tunnel1_preshared_key = aws_ssm_parameter.vpn_preshared_keys[each.key].value
tunnel2_preshared_key = aws_ssm_parameter.vpn_preshared_keys[each.key].value
tags = merge(var.default_tags, local.vpn_service_tag, {
"Name" : "${each.value["name"]}-vpn"
})
}