Skip to content

Commit e5db79b

Browse files
authored
Promote Packet Broker Security Profile to GA. (GoogleCloudPlatform#16403)
1 parent c822797 commit e5db79b

File tree

4 files changed

+110
-128
lines changed

4 files changed

+110
-128
lines changed

mmv1/products/networksecurity/SecurityProfile.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ examples:
5959
test_env_vars:
6060
org_id: 'ORG_ID'
6161
- name: 'network_security_security_profile_mirroring'
62-
min_version: 'beta'
6362
primary_resource_id: 'default'
6463
vars:
6564
resource_name: 'my-security-profile'
@@ -87,7 +86,6 @@ examples:
8786
org_id: 'ORG_ID'
8887
tgc_skip_test: The ENUM value URL_FILTERING in type field is transformed to UNKNOWN_ENUM_VALUE_ProfileType_5 in CAI asset. The reason could be that URL_FILTERING is not supported in CAI yet. Will check if the value in CAI assets will be correct later.
8988
- name: network_security_security_profile_broker
90-
min_version: 'beta'
9189
primary_resource_id: 'default'
9290
vars:
9391
resource_name: 'my-security-profile'
@@ -309,7 +307,6 @@ properties:
309307
This field is used for Packet Broker mirroring endpoint groups to specify
310308
the deployment groups that the packet should be mirrored to by the broker.
311309
Format: projects/{project_id}/locations/global/mirroringDeploymentGroups/{deployment_group_id}
312-
min_version: 'beta'
313310
- name: 'mirroringEndpointGroupType'
314311
type: String
315312
description: |-
@@ -318,7 +315,6 @@ properties:
318315
DIRECT
319316
BROKER
320317
output: true
321-
min_version: 'beta'
322318
conflicts:
323319
- 'threatPreventionProfile'
324320
- 'urlFilteringProfile'

mmv1/templates/terraform/examples/network_security_security_profile_broker.tf.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
resource "google_compute_network" "default" {
2-
provider = google-beta
32
name = "{{index $.Vars "network_name"}}"
43
auto_create_subnetworks = false
54
}
65

76
resource "google_network_security_mirroring_deployment_group" "default" {
8-
provider = google-beta
97
mirroring_deployment_group_id = "{{index $.Vars "deployment_group_id"}}"
108
location = "global"
119
network = google_compute_network.default.id
1210
}
1311

1412
resource "google_network_security_mirroring_endpoint_group" "default" {
15-
provider = google-beta
1613
mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}"
1714
location = "global"
1815
type = "BROKER"
1916
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
2017
}
2118

2219
resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" {
23-
provider = google-beta
2420
name = "{{index $.Vars "resource_name"}}"
2521
parent = "organizations/{{index $.TestEnvVars "org_id"}}"
2622
description = "my description"

mmv1/templates/terraform/examples/network_security_security_profile_mirroring.tf.tmpl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
resource "google_compute_network" "default" {
2-
provider = google-beta
32
name = "{{index $.Vars "network_name"}}"
43
auto_create_subnetworks = false
54
}
65

76
resource "google_network_security_mirroring_deployment_group" "default" {
8-
provider = google-beta
97
mirroring_deployment_group_id = "{{index $.Vars "deployment_group_id"}}"
108
location = "global"
119
network = google_compute_network.default.id
1210
}
1311

1412
resource "google_network_security_mirroring_endpoint_group" "default" {
15-
provider = google-beta
16-
mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}"
17-
location = "global"
18-
mirroring_deployment_group = google_network_security_mirroring_deployment_group.default.id
13+
mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}"
14+
location = "global"
15+
mirroring_deployment_group = google_network_security_mirroring_deployment_group.default.id
1916
}
2017

2118
resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" {
22-
provider = google-beta
2319
name = "{{index $.Vars "resource_name"}}"
2420
parent = "organizations/{{index $.TestEnvVars "org_id"}}"
2521
description = "my description"

mmv1/third_party/terraform/services/networksecurity/resource_network_security_security_profile_test.go.tmpl

Lines changed: 107 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ func TestAccNetworkSecuritySecurityProfiles_antivirusOverrides(t *testing.T) {
9595
})
9696
}
9797

98-
{{- if ne $.TargetVersionName "ga" }}
99-
func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate(t *testing.T) {
98+
func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBrokerUpdate(t *testing.T) {
10099
t.Parallel()
101100

102101
context := map[string]interface{}{
@@ -106,29 +105,52 @@ func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilt
106105

107106
acctest.VcrTest(t, resource.TestCase{
108107
PreCheck: func() { acctest.AccTestPreCheck(t) },
109-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
108+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
110109
CheckDestroy: testAccCheckNetworkSecuritySecurityProfileDestroyProducer(t),
111110
Steps: []resource.TestStep{
112111
{
113-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateEmpty(context),
112+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_basic(context),
114113
},
115114
{
116115
ResourceName: "google_network_security_security_profile.default",
117116
ImportState: true,
118117
ImportStateVerify: true,
119-
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
118+
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels"},
120119
},
121120
{
122-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate1(context),
121+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_update(context),
122+
ConfigPlanChecks: resource.ConfigPlanChecks{
123+
PreApply: []plancheck.PlanCheck{
124+
plancheck.ExpectResourceAction("google_network_security_security_profile.default", plancheck.ResourceActionUpdate),
125+
},
126+
},
123127
},
124128
{
125129
ResourceName: "google_network_security_security_profile.default",
126130
ImportState: true,
127131
ImportStateVerify: true,
128-
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
132+
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels"},
129133
},
134+
},
135+
})
136+
}
137+
138+
{{- if ne $.TargetVersionName "ga" }}
139+
func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate(t *testing.T) {
140+
t.Parallel()
141+
142+
context := map[string]interface{}{
143+
"org_id": envvar.GetTestOrgFromEnv(t),
144+
"random_suffix": acctest.RandString(t, 10),
145+
}
146+
147+
acctest.VcrTest(t, resource.TestCase{
148+
PreCheck: func() { acctest.AccTestPreCheck(t) },
149+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
150+
CheckDestroy: testAccCheckNetworkSecuritySecurityProfileDestroyProducer(t),
151+
Steps: []resource.TestStep{
130152
{
131-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate2(context),
153+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateEmpty(context),
132154
},
133155
{
134156
ResourceName: "google_network_security_security_profile.default",
@@ -137,66 +159,45 @@ func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilt
137159
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
138160
},
139161
{
140-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateDefault(context),
162+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate1(context),
141163
},
142164
{
143165
ResourceName: "google_network_security_security_profile.default",
144166
ImportState: true,
145167
ImportStateVerify: true,
146168
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
147169
},
148-
{
149-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateEmpty(context),
170+
{
171+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdate2(context),
150172
},
151173
{
152174
ResourceName: "google_network_security_security_profile.default",
153175
ImportState: true,
154176
ImportStateVerify: true,
155177
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
156178
},
157-
},
158-
})
159-
}
160-
161-
func TestAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBrokerUpdate(t *testing.T) {
162-
t.Parallel()
163-
164-
context := map[string]interface{}{
165-
"org_id": envvar.GetTestOrgFromEnv(t),
166-
"random_suffix": acctest.RandString(t, 10),
167-
}
168-
169-
acctest.VcrTest(t, resource.TestCase{
170-
PreCheck: func() { acctest.AccTestPreCheck(t) },
171-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
172-
CheckDestroy: testAccCheckNetworkSecuritySecurityProfileDestroyProducer(t),
173-
Steps: []resource.TestStep{
174179
{
175-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_basic(context),
180+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateDefault(context),
176181
},
177182
{
178183
ResourceName: "google_network_security_security_profile.default",
179184
ImportState: true,
180185
ImportStateVerify: true,
181-
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels"},
186+
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
182187
},
183-
{
184-
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_update(context),
185-
ConfigPlanChecks: resource.ConfigPlanChecks{
186-
PreApply: []plancheck.PlanCheck{
187-
plancheck.ExpectResourceAction("google_network_security_security_profile.default", plancheck.ResourceActionUpdate),
188-
},
189-
},
188+
{
189+
Config: testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateEmpty(context),
190190
},
191191
{
192192
ResourceName: "google_network_security_security_profile.default",
193193
ImportState: true,
194194
ImportStateVerify: true,
195-
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels"},
195+
ImportStateVerifyIgnore: []string{"labels", "location", "name", "parent", "terraform_labels", "url_filtering_profile"},
196196
},
197197
},
198198
})
199199
}
200+
200201
{{- end }}
201202

202203
func testAccNetworkSecuritySecurityProfiles_basic(orgId string, randomSuffix string) string {
@@ -276,6 +277,74 @@ resource "google_network_security_security_profile" "foobar" {
276277
`, randomSuffix, orgId)
277278
}
278279

280+
func testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_basic(context map[string]interface{}) string {
281+
return acctest.Nprintf(`
282+
resource "google_compute_network" "default" {
283+
name = "tf-test-my-network%{random_suffix}"
284+
auto_create_subnetworks = false
285+
}
286+
287+
resource "google_network_security_mirroring_deployment_group" "default" {
288+
mirroring_deployment_group_id = "tf-test-my-dg%{random_suffix}"
289+
location = "global"
290+
network = google_compute_network.default.id
291+
}
292+
293+
resource "google_network_security_mirroring_endpoint_group" "default" {
294+
mirroring_endpoint_group_id = "tf-test-my-eg%{random_suffix}"
295+
location = "global"
296+
type = "BROKER"
297+
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
298+
}
299+
300+
resource "google_network_security_security_profile" "default" {
301+
name = "tf-test-my-security-profile%{random_suffix}"
302+
parent = "organizations/%{org_id}"
303+
description = "my description"
304+
type = "CUSTOM_MIRRORING"
305+
306+
custom_mirroring_profile {
307+
mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id
308+
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
309+
}
310+
}
311+
`, context)
312+
}
313+
314+
func testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_update(context map[string]interface{}) string {
315+
return acctest.Nprintf(`
316+
resource "google_compute_network" "default" {
317+
name = "tf-test-my-network%{random_suffix}"
318+
auto_create_subnetworks = false
319+
}
320+
321+
resource "google_network_security_mirroring_deployment_group" "default" {
322+
mirroring_deployment_group_id = "tf-test-my-dg%{random_suffix}"
323+
location = "global"
324+
network = google_compute_network.default.id
325+
}
326+
327+
resource "google_network_security_mirroring_endpoint_group" "default" {
328+
mirroring_endpoint_group_id = "tf-test-my-eg%{random_suffix}"
329+
location = "global"
330+
type = "BROKER"
331+
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
332+
}
333+
334+
resource "google_network_security_security_profile" "default" {
335+
name = "tf-test-my-security-profile%{random_suffix}"
336+
parent = "organizations/%{org_id}"
337+
description = "my description"
338+
type = "CUSTOM_MIRRORING"
339+
340+
custom_mirroring_profile {
341+
mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id
342+
mirroring_deployment_groups = []
343+
}
344+
}
345+
`, context)
346+
}
347+
279348
{{- if ne $.TargetVersionName "ga" }}
280349
func testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileUrlFilteringUpdateEmpty(context map[string]interface{}) string {
281350
return acctest.Nprintf(`
@@ -370,79 +439,4 @@ resource "google_network_security_security_profile" "default" {
370439
`, context)
371440
}
372441

373-
func testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_basic(context map[string]interface{}) string {
374-
return acctest.Nprintf(`
375-
resource "google_compute_network" "default" {
376-
provider = google-beta
377-
name = "tf-test-my-network%{random_suffix}"
378-
auto_create_subnetworks = false
379-
}
380-
381-
resource "google_network_security_mirroring_deployment_group" "default" {
382-
provider = google-beta
383-
mirroring_deployment_group_id = "tf-test-my-dg%{random_suffix}"
384-
location = "global"
385-
network = google_compute_network.default.id
386-
}
387-
388-
resource "google_network_security_mirroring_endpoint_group" "default" {
389-
provider = google-beta
390-
mirroring_endpoint_group_id = "tf-test-my-eg%{random_suffix}"
391-
location = "global"
392-
type = "BROKER"
393-
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
394-
}
395-
396-
resource "google_network_security_security_profile" "default" {
397-
provider = google-beta
398-
name = "tf-test-my-security-profile%{random_suffix}"
399-
parent = "organizations/%{org_id}"
400-
description = "my description"
401-
type = "CUSTOM_MIRRORING"
402-
403-
custom_mirroring_profile {
404-
mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id
405-
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
406-
}
407-
}
408-
`, context)
409-
}
410-
411-
func testAccNetworkSecuritySecurityProfile_networkSecuritySecurityProfileMirroringBroker_update(context map[string]interface{}) string {
412-
return acctest.Nprintf(`
413-
resource "google_compute_network" "default" {
414-
provider = google-beta
415-
name = "tf-test-my-network%{random_suffix}"
416-
auto_create_subnetworks = false
417-
}
418-
419-
resource "google_network_security_mirroring_deployment_group" "default" {
420-
provider = google-beta
421-
mirroring_deployment_group_id = "tf-test-my-dg%{random_suffix}"
422-
location = "global"
423-
network = google_compute_network.default.id
424-
}
425-
426-
resource "google_network_security_mirroring_endpoint_group" "default" {
427-
provider = google-beta
428-
mirroring_endpoint_group_id = "tf-test-my-eg%{random_suffix}"
429-
location = "global"
430-
type = "BROKER"
431-
mirroring_deployment_groups = [google_network_security_mirroring_deployment_group.default.id]
432-
}
433-
434-
resource "google_network_security_security_profile" "default" {
435-
provider = google-beta
436-
name = "tf-test-my-security-profile%{random_suffix}"
437-
parent = "organizations/%{org_id}"
438-
description = "my description"
439-
type = "CUSTOM_MIRRORING"
440-
441-
custom_mirroring_profile {
442-
mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id
443-
mirroring_deployment_groups = []
444-
}
445-
}
446-
`, context)
447-
}
448442
{{- end }}

0 commit comments

Comments
 (0)