Closed powellquiring closed 1 year ago
Hi @powellquiring,
Yes, i was able to reproduce the issue and will update the doc with the correct example.
Thank you Sunitha
resource "ibm_is_vpc" "example" {
name = "example-vpc"
}
resource "ibm_is_subnet" "testacc_subnet1" {
name = "example-subnet"
vpc = ibm_is_vpc.example.id
zone = "us-south-1"
ipv4_cidr_block = "10.240.0.0/24"
}
resource "ibm_is_vpn_gateway" "testacc_VPNGateway1" {
name = "example-gateway"
subnet = ibm_is_subnet.testacc_subnet1.id
mode = "route"
}
resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection1" {
name = "example-gateway-connection"
vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway1.id
peer_address = ibm_is_vpn_gateway.testacc_VPNGateway1.public_ip_address
preshared_key = "VPNDemoPassword"
}
resource "ibm_is_vpc_routing_table" "example" {
vpc = ibm_is_vpc.example.id
name = "example-routing-table"
route_direct_link_ingress = true
route_transit_gateway_ingress = false
route_vpc_zone_ingress = false
}
resource "ibm_is_vpc_routing_table_route" "example" {
vpc = ibm_is_vpc.example.id
routing_table = ibm_is_vpc_routing_table.example.routing_table
zone = "us-south-1"
name = "custom-route-2"
destination = "192.168.4.0/24"
action = "deliver"
// next_hop = "10.240.0.0" //ibm_is_vpn_gateway_connection.example.gateway_connection // Example value "10.0.0.4"
next_hop = ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1.gateway_connection
}
With the below setup, the configuration works fine..
resource "ibm_is_vpc" "example" {
name = "example-vpc"
}
resource "ibm_is_subnet" "testacc_subnet1" {
name = "example-subnet"
vpc = ibm_is_vpc.example.id
zone = "us-south-1"
ipv4_cidr_block = "10.240.0.0/24"
}
resource "ibm_is_vpn_gateway" "testacc_VPNGateway1" {
name = "example-gateway"
subnet = ibm_is_subnet.testacc_subnet1.id
mode = "route"
}
resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection1" {
name = "example-gateway-connection"
vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway1.id
peer_address = ibm_is_vpn_gateway.testacc_VPNGateway1.public_ip_address
preshared_key = "VPNDemoPassword"
}
resource "ibm_is_vpc_routing_table" "example" {
vpc = ibm_is_vpc.example.id
name = "example-routing-table"
route_direct_link_ingress = false
route_transit_gateway_ingress = false
route_vpc_zone_ingress = false
}
resource "ibm_is_vpc_routing_table_route" "example" {
vpc = ibm_is_vpc.example.id
routing_table = ibm_is_vpc_routing_table.example.routing_table
zone = "us-south-1"
name = "custom-route-2"
destination = "192.168.4.0/24"
action = "deliver"
// next_hop = "10.240.0.0" //ibm_is_vpn_gateway_connection.example.gateway_connection // Example value "10.0.0.4"
next_hop = ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1.gateway_connection
}
Community Note
Terraform CLI and Terraform IBM Provider Version
Affected Resource(s)
Terraform Configuration Files
Terraform example is here: https://github.com/IBM-Cloud/vpc-transit/blob/master/modules/vpn_tf/vpn.tf
Added ingress route in hub to VPN using terraform:
Trying the following from the CLI, notice the VPC and Route Table are the same as the ones above. This worked:
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.