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

Adding pdpScope field to PAP resource #12803

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mmv1/products/compute/PublicAdvertisedPrefix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ 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_advertised_prefixes_pdp_scope'
primary_resource_id: 'prefixes'
vars:
prefixes_name: 'my-pap'
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: 'description'
Expand All @@ -70,6 +79,14 @@ properties:
The IPv4 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
enum_values:
- 'GLOBAL'
- 'REGIONAL'
- name: 'sharedSecret'
type: String
description: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "google_compute_public_advertised_prefix" "{{$.PrimaryResourceId}}" {
name = "{{index $.Vars "prefixes_name"}}"
description = "{{index $.TestEnvVars "desc"}}"
dns_verification_ip = "127.127.0.0"
ip_cidr_range = "127.127.0.0/16"
pdp_scope = "REGIONAL"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ 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,
"delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest,
"advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest,
"advertised_prefix_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest,
}

for name, tc := range testCases {
Expand All @@ -32,6 +33,41 @@ func TestAccComputePublicPrefixes(t *testing.T) {
}
}

func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest(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: testAccCheckComputePublicAdvertisedPrefixDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeExample(context),
},
{
ResourceName: "google_compute_public_advertised_prefix.prefix",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeExample(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_compute_public_advertised_prefix" "prefix" {
name = "tf-test-my-prefix%{random_suffix}"
description = "%{description}"
dns_verification_ip = "127.127.0.0"
ip_cidr_range = "127.127.0.0/16"
pdp_scope = "REGIONAL"
}
`, context)
}

func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest(t *testing.T) {
t.Parallel()

Expand Down
Loading