Skip to content

Commit c029795

Browse files
Add support for IPv6 addresses with the google_compute_external_vpn_gateway terraform resource (#11982)
1 parent 81d5235 commit c029795

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

mmv1/products/compute/ExternalVpnGateway.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,12 @@ properties:
121121
Only IPv4 is supported. This IP address can be either from
122122
your on-premise gateway or another Cloud provider's VPN gateway,
123123
it cannot be an IP address from Google Compute Engine.
124+
- name: 'ipv6Address'
125+
type: String
126+
description: |
127+
IPv6 address of the interface in the external VPN gateway. This IPv6
128+
address can be either from your on-premise gateway or another Cloud
129+
provider's VPN gateway, it cannot be an IP address from Google Compute
130+
Engine. Must specify an IPv6 address (not IPV4-mapped) using any format
131+
described in RFC 4291 (e.g. 2001:db8:0:0:2d9:51:0:0). The output format
132+
is RFC 5952 format (e.g. 2001:db8::2d9:51:0:0).

mmv1/third_party/terraform/services/compute/resource_compute_external_vpn_gateway_test.go

+39
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,42 @@ resource "google_compute_external_vpn_gateway" "external_gateway" {
6565
}
6666
`, suffix, key, value)
6767
}
68+
69+
func TestAccComputeExternalVPNGateway_insertIpv6Address(t *testing.T) {
70+
t.Parallel()
71+
72+
rnd := acctest.RandString(t, 10)
73+
resourceName := "google_compute_external_vpn_gateway.external_gateway"
74+
75+
acctest.VcrTest(t, resource.TestCase{
76+
PreCheck: func() { acctest.AccTestPreCheck(t) },
77+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
78+
Steps: []resource.TestStep{
79+
{
80+
Config: computeExternalVPNGatewayIpv6AddressConfig(rnd, "2001:db8:abcd:1234:5678:90ab:cdef:1234"),
81+
Check: resource.ComposeTestCheckFunc(
82+
resource.TestCheckResourceAttr(resourceName, "interface.0.ipv6_address", "2001:db8:abcd:1234:5678:90ab:cdef:1234"),
83+
),
84+
},
85+
{
86+
ResourceName: resourceName,
87+
ImportState: true,
88+
ImportStateVerify: true,
89+
},
90+
},
91+
})
92+
}
93+
94+
func computeExternalVPNGatewayIpv6AddressConfig(suffix, ipv6_address string) string {
95+
return fmt.Sprintf(`
96+
resource "google_compute_external_vpn_gateway" "external_gateway" {
97+
name = "tf-test-external-gateway-%s"
98+
redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT"
99+
description = "An externally managed VPN gateway"
100+
interface {
101+
id = 0
102+
ipv6_address = "%s"
103+
}
104+
}
105+
`, suffix, ipv6_address)
106+
}

0 commit comments

Comments
 (0)