Skip to content

Commit 4c71459

Browse files
Adding IPv6 Access Type to PAP (#15548)
1 parent 82edd43 commit 4c71459

File tree

3 files changed

+72
-8
lines changed

3 files changed

+72
-8
lines changed

mmv1/products/compute/PublicAdvertisedPrefix.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ examples:
5454
# PAPs have very low quota limits and a shared testing range so serialized tests exist in:
5555
# resource_compute_public_advertised_prefix_test.go
5656
exclude_test: true
57+
- name: 'public_advertised_prefixes_ipv6_access_type'
58+
primary_resource_id: 'prefixes'
59+
vars:
60+
prefixes_name: 'my-pap'
61+
test_env_vars:
62+
desc: 'PAP_DESCRIPTION'
63+
# PAPs have very low quota limits and a shared testing range so serialized tests exist in:
64+
# resource_compute_public_advertised_prefix_test.go
65+
exclude_test: true
5766
parameters:
5867
properties:
5968
- name: 'description'
@@ -72,7 +81,6 @@ properties:
7281
- name: 'dnsVerificationIp'
7382
type: String
7483
description: The IPv4 address to be used for reverse DNS verification.
75-
required: true
7684
- name: 'ipCidrRange'
7785
type: String
7886
description:
@@ -91,6 +99,20 @@ properties:
9199
enum_values:
92100
- 'GLOBAL'
93101
- 'REGIONAL'
102+
- name: 'ipv6AccessType'
103+
type: Enum
104+
description: |
105+
The internet access type for IPv6 Public Advertised Prefixes. It can be
106+
set to one of following:
107+
* EXTERNAL: Default access type. The prefix will be announced to the
108+
internet. All children PDPs will have access type as EXTERNAL.
109+
* INTERNAL: The prefix won’t be announced to the internet. Prefix will
110+
be used privately within Google Cloud. All children PDPs will have
111+
access type as INTERNAL.
112+
default_from_api: true
113+
enum_values:
114+
- 'EXTERNAL'
115+
- 'INTERNAL'
94116
- name: 'sharedSecret'
95117
type: String
96118
description: |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "google_compute_public_advertised_prefix" "{{$.PrimaryResourceId}}" {
2+
name = "{{index $.Vars "prefixes_name"}}"
3+
description = "{{index $.TestEnvVars "desc"}}"
4+
ip_cidr_range = "2001:db8::/32"
5+
pdp_scope = "REGIONAL"
6+
ipv6_access_type = "INTERNAL"
7+
}

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

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import (
1616
// Since we only have access to one test prefix range we cannot run tests in parallel
1717
func TestAccComputePublicPrefixes(t *testing.T) {
1818
testCases := map[string]func(t *testing.T){
19-
"delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest,
20-
"advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest,
21-
"public_delegated_prefixes_ipv6": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test,
22-
"public_advertised_prefixes_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest,
23-
"public_delegated_prefix_ipv6_subnet_mode": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixIpv6SubnetModeTest,
24-
"public_delgated_prefix_with_sub_prefix": TestAccComputePublicDelegatedPrefix_computePublicDelegatedPrefixWithSubPrefixExample,
19+
"delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest,
20+
"advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest,
21+
"public_delegated_prefixes_ipv6": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test,
22+
"public_advertised_prefixes_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest,
23+
"public_delegated_prefix_ipv6_subnet_mode": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixIpv6SubnetModeTest,
24+
"public_delgated_prefix_with_sub_prefix": TestAccComputePublicDelegatedPrefix_computePublicDelegatedPrefixWithSubPrefixExample,
25+
"public_advertised_prefixes_internal_ipv6_access": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesInternalIpv6AccessTest,
2526
}
2627

2728
for name, tc := range testCases {
@@ -36,8 +37,42 @@ func TestAccComputePublicPrefixes(t *testing.T) {
3637
}
3738
}
3839

40+
func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesInternalIpv6AccessTest(t *testing.T) {
41+
context := map[string]interface{}{
42+
"description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t),
43+
"random_suffix": acctest.RandString(t, 10),
44+
}
45+
46+
acctest.VcrTest(t, resource.TestCase{
47+
PreCheck: func() { acctest.AccTestPreCheck(t) },
48+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
49+
CheckDestroy: testAccCheckComputePublicAdvertisedPrefixDestroyProducer(t),
50+
Steps: []resource.TestStep{
51+
{
52+
Config: testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesInternalIpv6AccessExample(context),
53+
},
54+
{
55+
ResourceName: "google_compute_public_advertised_prefix.prefix",
56+
ImportState: true,
57+
ImportStateVerify: true,
58+
},
59+
},
60+
})
61+
}
62+
63+
func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesInternalIpv6AccessExample(context map[string]interface{}) string {
64+
return acctest.Nprintf(`
65+
resource "google_compute_public_advertised_prefix" "prefix" {
66+
name = "tf-test-my-prefix%{random_suffix}"
67+
description = "%{description}"
68+
ip_cidr_range = "2001:db8::/32"
69+
pdp_scope = "REGIONAL"
70+
ipv6_access_type = "INTERNAL"
71+
}
72+
`, context)
73+
}
74+
3975
func TestAccComputePublicDelegatedPrefix_computePublicDelegatedPrefixWithSubPrefixExample(t *testing.T) {
40-
t.Parallel()
4176
subPrefixResourceName := "google_compute_public_delegated_prefix.subprefix"
4277
parentProject := "tf-static-byoip"
4378
parentRegion := "us-central1"

0 commit comments

Comments
 (0)