terraform-aws-modules / terraform-aws-vpn-gateway

Terraform module to create AWS VPN gateway resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/vpn-gateway/aws
Apache License 2.0
111 stars 154 forks source link

v2.12 breaks for IPv4 only setup #68

Closed kai-66degrees closed 2 years ago

kai-66degrees commented 2 years ago

Description

I was using this module earlier and it was working perfectly however upgrading to v2.12 adds an error related to IPv6 configuration, which I am not using.

Rolling back to v2.11.1 solves the issue.

Error

Error: Missing required argument │ │ with module.aws-gcp-vpn-tunnels.module.vpn_gateway.aws_vpn_connection.tunnel_preshared[0], │ on .terraform/modules/aws-gcp-vpn-tunnels.vpn_gateway/main.tf line 304, in resource "aws_vpn_connection" "tunnel_preshared": │ 304: local_ipv6_network_cidr = var.local_ipv6_network_cidr │ │ "local_ipv6_network_cidr": all of │ local_ipv6_network_cidr,transit_gateway_id must be specified

ZeroDeth commented 2 years ago

facing the same issue:

Error: error modifying EC2 VPN Connection (vpn-07bcd52b7e0637789) connection options: InvalidParameterValue: The LocalIpv6NetworkCidr parameter cannot be specified for vpn of addressing type IPv4 status code: 400, request id: 7abd4e79-b941-4085-bb57-c3e1c967ad51
with module.vpn_gateway.aws_vpn_connection.tunnel_preshared[0]
on .terraform/modules/vpn_gateway/main.tf line 240, in resource "aws_vpn_connection" "tunnel_preshared":
resource "aws_vpn_connection" "tunnel_preshared" {
antonbabenko commented 2 years ago

Could someone provide a piece of configuration that breaks?

kai-66degrees commented 2 years ago

module "vpn_gateway" { source = "terraform-aws-modules/vpn-gateway/aws" version = "2.11.1"

vpc_id = var.vpc_id vpn_gateway_id = aws_vpn_gateway.vpn_gw.id customer_gateway_id = aws_customer_gateway.main.id create_vpn_connection = true create_vpn_gateway_attachment = true

vpc_subnet_route_table_count = var.route_table_count vpc_subnet_route_table_ids = var.route_table_id

tunnel1_inside_cidr = var.custom_tunnel1_inside_cidr tunnel2_inside_cidr = var.custom_tunnel2_inside_cidr

tunnel1_preshared_key = var.custom_tunnel1_preshared_key tunnel2_preshared_key = var.custom_tunnel2_preshared_key

local_ipv4_network_cidr = var.local_ipv4_network_cidr remote_ipv4_network_cidr = var.remote_ipv4_network_cidr

tags = var.tags

}

rvega-devopsgroup commented 2 years ago

The following code works on version 2.11.1 but doesn't work on version 2.12.0

module "vpn_gateway" {
  source  = "terraform-aws-modules/vpn-gateway/aws"
  version = "2.12.0"

  vpc_id                                                              = module.vpc.vpc_id
  vpn_gateway_id                                              = module.vpc.vgw_id
  customer_gateway_id                                     = module.vpc.cgw_ids[0]
  vpn_connection_static_routes_only              = true
  vpn_connection_static_routes_destinations = [module.vpn_vpc.vpc_cidr_block]

  # precalculated length of module variable vpc_subnet_route_table_ids
  vpc_subnet_route_table_count = 3
  vpc_subnet_route_table_ids     = module.vpc.private_route_table_ids

  tags = {
    Name = var.name
  }
}
antonbabenko commented 2 years ago

This issue has been resolved in version 2.12.1 :tada:

antonbabenko commented 2 years ago

Thank you guys for providing code samples. Please try version 2.12.1, where this issue was fixed.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.