diff --git a/mmv1/products/compute/PublicAdvertisedPrefix.yaml b/mmv1/products/compute/PublicAdvertisedPrefix.yaml index 59ceab2fa248..7bb00b7ba536 100644 --- a/mmv1/products/compute/PublicAdvertisedPrefix.yaml +++ b/mmv1/products/compute/PublicAdvertisedPrefix.yaml @@ -76,14 +76,18 @@ properties: - name: 'ipCidrRange' type: String description: - The IPv4 address range, in CIDR format, represented by this public - advertised prefix. + The address range, in CIDR format, represented by this public advertised + prefix. required: true - name: 'pdpScope' type: Enum description: | Specifies how child public delegated prefix will be scoped. pdpScope must be one of: GLOBAL, REGIONAL + * REGIONAL: The public delegated prefix is regional only. The + provisioning will take a few minutes. + * GLOBAL: The public delegated prefix is global only. The provisioning + will take ~4 weeks. enum_values: - 'GLOBAL' - 'REGIONAL' diff --git a/mmv1/products/compute/PublicDelegatedPrefix.yaml b/mmv1/products/compute/PublicDelegatedPrefix.yaml index 966f528f0cb6..a36264d535d2 100644 --- a/mmv1/products/compute/PublicDelegatedPrefix.yaml +++ b/mmv1/products/compute/PublicDelegatedPrefix.yaml @@ -35,6 +35,10 @@ async: result: resource_inside_response: false custom_code: +sweeper: + regions: + - us-central1 + - us-west1 examples: - name: 'public_delegated_prefixes_basic' primary_resource_id: 'prefixes' @@ -45,6 +49,16 @@ examples: # PAPs have very low quota limits and a shared testing range so serialized tests exist in: # resource_compute_public_advertised_prefix_test.go exclude_test: true + - name: 'public_delegated_prefixes_ipv6' + vars: + pap_name: "ipv6-pap" + root_pdp_name: "ipv6-root-pdp" + sub_pdp_name: "ipv6-sub-pdp" + test_env_vars: + desc: 'PAP_DESCRIPTION' + # PAPs have very low quota limits and a shared testing range so serialized tests exist in: + # resource_compute_public_advertised_prefix_test.go + exclude_test: true parameters: properties: - name: 'region' @@ -75,9 +89,23 @@ properties: PublicDelegatedPrefix. required: true diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' + - name: 'mode' + type: Enum + description: | + Specifies the mode of this IPv6 PDP. MODE must be one of: DELEGATION, + EXTERNAL_IPV6_FORWARDING_RULE_CREATION. + enum_values: + - 'DELEGATION' + - 'EXTERNAL_IPV6_FORWARDING_RULE_CREATION' + - name: 'allocatablePrefixLength' + type: Integer + description: + The allocatable prefix length supported by this public delegated prefix. + This field is optional and cannot be set for prefixes in DELEGATION mode. + It cannot be set for IPv4 prefixes either, and it always defaults to 32. - name: 'ipCidrRange' type: String description: - The IPv4 address range, in CIDR format, represented by this public - advertised prefix. + The IP address range, in CIDR format, represented by this public + delegated prefix. required: true diff --git a/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl new file mode 100644 index 000000000000..bef58fafba8d --- /dev/null +++ b/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl @@ -0,0 +1,26 @@ +resource "google_compute_public_advertised_prefix" "advertised" { + name = "{{index $.Vars "pap_name"}}" + description = "{{index $.TestEnvVars "desc"}}" + dns_verification_ip = "2001:db8::" + ip_cidr_range = "2001:db8::/32" + pdp_scope = "REGIONAL" +} + +resource "google_compute_public_delegated_prefix" "prefix" { + name = "{{index $.Vars "root_pdp_name"}}" + description = "test-delegation-mode-pdp" + region = "us-west1" + ip_cidr_range = "2001:db8::/40" + parent_prefix = google_compute_public_advertised_prefix.advertised.id + mode = "DELEGATION" +} + +resource "google_compute_public_delegated_prefix" "subprefix" { + name = "{{index $.Vars "sub_pdp_name"}}" + description = "test-forwarding-rule-mode-pdp" + region = "us-west1" + ip_cidr_range = "2001:db8::/48" + parent_prefix = google_compute_public_delegated_prefix.prefix.id + allocatable_prefix_length = 64 + mode = "EXTERNAL_IPV6_FORWARDING_RULE_CREATION" +} diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go index ccbf5df9fd18..09bcdedb82d9 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go @@ -16,9 +16,10 @@ import ( // Since we only have access to one test prefix range we cannot run tests in parallel func TestAccComputePublicPrefixes(t *testing.T) { testCases := map[string]func(t *testing.T){ - "delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest, - "advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest, - "advertised_prefix_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest, + "delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest, + "advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest, + "public_delegated_prefixes_ipv6": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test, + "public_advertised_prefixes_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest, } for name, tc := range testCases { @@ -155,6 +156,61 @@ resource "google_compute_public_delegated_prefix" "subprefix" { `, context) } +func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test(t *testing.T) { + context := map[string]interface{}{ + "description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckComputePublicDelegatedPrefixDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Example(context), + }, + { + ResourceName: "google_compute_public_delegated_prefix.prefix", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"region"}, + }, + }, + }) +} + +func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Example(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_compute_public_advertised_prefix" "advertised" { + name = "tf-test-ipv6-pap%{random_suffix}" + description = "%{description}" + dns_verification_ip = "2001:db8::" + ip_cidr_range = "2001:db8::/32" + pdp_scope = "REGIONAL" +} + +resource "google_compute_public_delegated_prefix" "prefix" { + name = "tf-test-root-pdp%{random_suffix}" + description = "test-delegation-mode-pdp" + region = "us-west1" + ip_cidr_range = "2001:db8::/40" + parent_prefix = google_compute_public_advertised_prefix.advertised.id + mode = "DELEGATION" +} + +resource "google_compute_public_delegated_prefix" "subprefix" { + name = "tf-test-sub-pdp%{random_suffix}" + description = "test-forwarding-rule-mode-pdp" + region = "us-west1" + ip_cidr_range = "2001:db8::/48" + parent_prefix = google_compute_public_delegated_prefix.prefix.id + allocatable_prefix_length = 64 + mode = "EXTERNAL_IPV6_FORWARDING_RULE_CREATION" +} +`, context) +} + func testAccCheckComputePublicDelegatedPrefixDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for name, rs := range s.RootModule().Resources {