Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate HA VPN tunnels to GA #133

Closed
Sekyrovat opened this issue Nov 6, 2023 · 2 comments
Closed

Migrate HA VPN tunnels to GA #133

Sekyrovat opened this issue Nov 6, 2023 · 2 comments
Labels
blocked Blocked by some other work enhancement New feature or request upstream Work required on Terraform core or provider

Comments

@Sekyrovat
Copy link

Sekyrovat commented Nov 6, 2023

TL;DR

Remove instances of provider = google-beta from the submodule in favour of the GA.

Terraform Resources

Terraform resource I'm leveraging to create the full VPN while getting issues

module "vpnVpcA" {
  source           = "terraform-google-modules/vpn/google//modules/vpn_ha"
  version          = "~> 1.3.0"
  router_name      = google_compute_router.crVpcA.name
  project_id       = var.projects["sideA"]
  region           = var.region_picks["nane1"]
  network          = var.vpc_pick["vpcA"]
  name             = "op2gcp"
  router_asn       = 64515
  peer_gcp_gateway = module.vpnVpcB.self_link
    tunnels = {
      remote-0 = {
        bgp_peer = {
          address = "169.254.1.1"
          asn     = 64517
        }
        bgp_peer_options                = null
        bgp_session_range               = "169.254.1.2/30"
        ike_version                     = 2
        vpn_gateway_interface           = 0
        peer_external_gateway_interface = null
        shared_secret                   = ""
      }
      remote-1 = {
        bgp_peer = {
          address = "169.254.2.1"
          asn     = 64517
        }
        bgp_peer_options                = null
        bgp_session_range               = "169.254.2.2/30"
        ike_version                     = 2
        vpn_gateway_interface           = 1
        peer_external_gateway_interface = null
        shared_secret                   = ""
      }
    }
  router_advertise_config = local.vpn0CustomRoutes
  depends_on              = [module.vpcA]
}

Working approach, leverages the same core HA VPN submodule but creates the tunnels separately through the core resource.

module "vpnVpcA" {
  source           = "terraform-google-modules/vpn/google//modules/vpn_ha"
  version          = "~> 1.3.0"
  router_name      = google_compute_router.crVpcA.name
  project_id       = var.projects["sideA"]
  region           = var.region_picks["nane1"]
  network          = var.vpc_pick["vpcA"]
  name             = "op2gcp"
  router_asn       = 64515
  peer_gcp_gateway = module.vpnVpcB.self_link
  router_advertise_config = local.vpn0CustomRoutes
  depends_on              = [module.vpcA]
}

resource "google_compute_vpn_tunnel" "intunnel" {
  name                  = "in"
  project = var.projects["sideA"]
  region                = var.region_picks["nane1"]
  vpn_gateway           = module.vpnVpcA.gateway.id
  peer_gcp_gateway      = module.vpnVpcB.gateway.id
  shared_secret         = "pennyandjoey"
  router                = google_compute_router.crVpcA.id
  vpn_gateway_interface = 0
}

Detailed design

VPC SC is configured in the Side B project/org, and permissions are given as iterations fail, so far the only permission we are unable to tackle pertains to the call compute.beta.VpnTunnelsService.Insert.

Additional information

Currently creating HA VPN constructs through the HA VPN submodule seems to be calling to the Beta APIs. This presents itself as an issue when working with VPC SC.

When creating the Tunnels the following call seems to be made compute.beta.VpnTunnelsService.Insert, the issue that arises is that in VPC SC we can't target Beta calls, therefore creating Tunnels fails.

This issue may be present more widely than the tunnels themselves however and therefore the potential removal of the Beta provider should be done for the submodule as a whole.

@Sekyrovat Sekyrovat added the enhancement New feature or request label Nov 6, 2023
@imrannayer
Copy link
Collaborator

Labels in google_compute_vpn_tunnel is not available in GA provider. Created an issue for the provider team.

hashicorp/terraform-provider-google#16458

@imrannayer imrannayer added upstream Work required on Terraform core or provider blocked Blocked by some other work labels Nov 6, 2023
@imrannayer
Copy link
Collaborator

fixed in #135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by some other work enhancement New feature or request upstream Work required on Terraform core or provider
Projects
None yet
Development

No branches or pull requests

2 participants