From 3dd586c8cb4b1e12479eed07b40eee58f46f9d70 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Fri, 14 Jun 2024 05:57:36 +0000 Subject: [PATCH 1/8] Add Resource SCC V2 Project Nofitification Config --- .../ProjectNotificationConfig.yaml | 130 ++++++++++++++++++ mmv1/products/securitycenterv2/product.yaml | 23 ++++ ...2_project_notification_config_basic.tf.erb | 15 ++ .../components/inputs/services_beta.kt | 5 + .../components/inputs/services_ga.kt | 5 + ...scc_v2_project_notification_config_test.go | 65 +++++++++ 6 files changed, 243 insertions(+) create mode 100644 mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml create mode 100644 mmv1/products/securitycenterv2/product.yaml create mode 100644 mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb create mode 100644 mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml new file mode 100644 index 000000000000..afd8705b74f2 --- /dev/null +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -0,0 +1,130 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +name: 'ProjectNotificationConfig' +base_url: projects/{{project}}/locations/{location}/notificationConfigs +self_link: '{{name}}' +create_url: projects/{{project}}/locations/{location}/notificationConfigs?configId={{config_id}} +update_verb: :PATCH +update_mask: true +description: | + A Cloud Security Command Center (Cloud SCC) notification configs. A + notification config is a Cloud SCC resource that contains the + configuration to send notifications for create/update events of + findings, assets and etc. + ~> **Note:** In order to use Cloud SCC resources, your organization must be enrolled + in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center). + Without doing so, you may run into errors during resource creation. +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/security-command-center/docs' + api: 'https://cloud.google.com/security-command-center/docs/reference/rest/v2/projects.locations.notificationConfigs' +examples: + - !ruby/object:Provider::Terraform::Examples + name: 'scc_v2_project_notification_config_basic' + primary_resource_id: 'custom_notification_config' + vars: + topic_name: 'my-topic' + config_id: 'my-config' + test_env_vars: + org_id: :ORG_ID +custom_code: !ruby/object:Provider::Terraform::CustomCode + custom_import: templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.erb + post_create: templates/terraform/post_create/set_computed_name.erb +parameters: + - !ruby/object:Api::Type::String + name: project + required: true + immutable: true + url_param_only: true + description: | + The project whose Cloud Security Command Center the Notification + Config lives in. + - !ruby/object:Api::Type::String + name: configId + required: true + immutable: true + url_param_only: true + description: | + This must be unique within the project. + - !ruby/object:Api::Type::String + name: 'location' + immutable: true + required: false + url_param_only: true + default_value: 'global' + description: | + Location ID of the parent organization. Only global is supported at the moment. +properties: + - !ruby/object:Api::Type::String + name: name + output: true + description: | + The resource name of this notification config, in the format + `projects/{{project}}/locations/{location}/notificationConfigs/{{config_id}}`. + - !ruby/object:Api::Type::String + name: description + description: | + The description of the notification config (max of 1024 characters). + validation: !ruby/object:Provider::Terraform::Validation + function: 'validation.StringLenBetween(0, 1024)' + - !ruby/object:Api::Type::String + name: pubsubTopic + required: true + description: | + The Pub/Sub topic to send notifications to. Its format is + "projects/[project_id]/topics/[topic]". + - !ruby/object:Api::Type::String + name: serviceAccount + output: true + description: | + The service account that needs "pubsub.topics.publish" permission to + publish to the Pub/Sub topic. + - !ruby/object:Api::Type::NestedObject + name: streamingConfig + required: true + description: | + The config for triggering streaming-based notifications. + update_mask_fields: + - 'streamingConfig.filter' + properties: + - !ruby/object:Api::Type::String + name: filter + required: true + description: | + Expression that defines the filter to apply across create/update + events of assets or findings as specified by the event type. The + expression is a list of zero or more restrictions combined via + logical operators AND and OR. Parentheses are supported, and OR + has higher precedence than AND. + + Restrictions have the form and may have + a - character in front of them to indicate negation. The fields + map to those defined in the corresponding resource. + + The supported operators are: + + * = for all value types. + * >, <, >=, <= for integer values. + * :, meaning substring matching, for strings. + + The supported value types are: + + * string literals in quotes. + * integer literals without quotes. + * boolean literals true and false without quotes. + + See + [Filtering notifications](https://cloud.google.com/security-command-center/docs/how-to-api-filter-notifications) + for information on how to write a filter. diff --git a/mmv1/products/securitycenterv2/product.yaml b/mmv1/products/securitycenterv2/product.yaml new file mode 100644 index 000000000000..cd0a2b544f74 --- /dev/null +++ b/mmv1/products/securitycenterv2/product.yaml @@ -0,0 +1,23 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Product +name: SecurityCenterV2 +display_name: Security Command Center (SCC) +legacy_name: scc_v2 +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://securitycenter.googleapis.com/v2/ +scopes: + - https://www.googleapis.com/auth/cloud-platform diff --git a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb new file mode 100644 index 000000000000..96b8fc82fdd3 --- /dev/null +++ b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb @@ -0,0 +1,15 @@ +resource "google_pubsub_topic" "scc_v2_project_notification" { + name = "<%= ctx[:vars]['topic_name'] %>" +} + +resource "google_scc_v2_project_notification_config" "<%= ctx[:primary_resource_id] %>" { + config_id = "<%= ctx[:vars]['config_id'] %>" + organization = "<%= ctx[:test_env_vars]['org_id'] %>" + description = "My custom Cloud Security Command Center Finding Notification Configuration" + pubsub_topic = google_pubsub_topic.scc_notification.id + location = "global" + + streaming_config { + filter = "category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"" + } +} diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index 7804a4a11ad7..d149e886fd66 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -621,6 +621,11 @@ var ServicesListBeta = mapOf( "displayName" to "Securitycenter", "path" to "./google-beta/services/securitycenter" ), + "securitycenterv2" to mapOf( + "name" to "securitycenterv2", + "displayName" to "securitycenterv2", + "path" to "./google-beta/services/securitycenterv2" + ), "securitycentermanagement" to mapOf( "name" to "securitycentermanagement", "displayName" to "Securitycentermanagement", diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index 76cf658afd9b..fd7c53e5f8dc 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -616,6 +616,11 @@ var ServicesListGa = mapOf( "displayName" to "Securitycenter", "path" to "./google/services/securitycenter" ), + "securitycenterv2" to mapOf( + "name" to "securitycenterv2", + "displayName" to "securitycenterv2", + "path" to "./google/services/securitycenterv2" + ), "securitycentermanagement" to mapOf( "name" to "securitycentermanagement", "displayName" to "Securitycentermanagement", diff --git a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go new file mode 100644 index 000000000000..a11ceaa61dc8 --- /dev/null +++ b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go @@ -0,0 +1,65 @@ +package securitycenterv2_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilter(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_id": envvar.GetTestProjectFromEnv(t), + "location": "global", + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckSecurityCenterV2ProjectNotificationConfigDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccSecurityCenterV2ProjectNotificationConfig_sccV2ProjectNotificationConfigBasicExample(context), + }, + { + ResourceName: "google_scc_v2_project_notification_config.custom_notification_config", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"project", "config_id"}, + }, + { + Config: testAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilter(context), + }, + { + ResourceName: "google_scc_v2_project_notification_config.custom_notification_config", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"project", "config_id"}, + }, + }, + }) +} + +func testAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilter(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_pubsub_topic" "scc_v2_project_notification" { + name = "tf-test-my-topic%{random_suffix}" +} + +resource "google_scc_v2_project_notification_config" "custom_notification_config" { + config_id = "tf-test-my-config%{random_suffix}" + project = "%{project_id}" + description = "My custom Cloud Security Command Center Finding Notification Configuration" + pubsub_topic = google_pubsub_topic.scc_v2_project_notification.id + location = "global" + + streaming_config { + filter = "category = \"OPEN_FIREWALL\"" + } +} +`, context) +} From 18ad1e89d2fea400920639eb4b54266dfbd01847 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Wed, 19 Jun 2024 18:18:04 +0000 Subject: [PATCH 2/8] Update the parameter name --- .../securitycenterv2/ProjectNotificationConfig.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index afd8705b74f2..e4c929f195b3 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -13,9 +13,9 @@ --- !ruby/object:Api::Resource name: 'ProjectNotificationConfig' -base_url: projects/{{project}}/locations/{location}/notificationConfigs +base_url: projects/{{projectId}}/locations/{location}/notificationConfigs self_link: '{{name}}' -create_url: projects/{{project}}/locations/{location}/notificationConfigs?configId={{config_id}} +create_url: projects/{{projectId}}/locations/{location}/notificationConfigs?configId={{config_id}} update_verb: :PATCH update_mask: true description: | @@ -44,7 +44,7 @@ custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/set_computed_name.erb parameters: - !ruby/object:Api::Type::String - name: project + name: projectId required: true immutable: true url_param_only: true @@ -72,7 +72,7 @@ properties: output: true description: | The resource name of this notification config, in the format - `projects/{{project}}/locations/{location}/notificationConfigs/{{config_id}}`. + `projects/{{projectId}}/locations/{location}/notificationConfigs/{{config_id}}`. - !ruby/object:Api::Type::String name: description description: | From a2a0d1d3e862e891e916dc8877a21c1aa91c93d6 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Wed, 19 Jun 2024 21:51:57 +0000 Subject: [PATCH 3/8] Refactor resource name --- .../examples/scc_v2_project_notification_config_basic.tf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb index 96b8fc82fdd3..ffb45ca9d2d0 100644 --- a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb +++ b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb @@ -6,7 +6,7 @@ resource "google_scc_v2_project_notification_config" "<%= ctx[:primary_resource_ config_id = "<%= ctx[:vars]['config_id'] %>" organization = "<%= ctx[:test_env_vars]['org_id'] %>" description = "My custom Cloud Security Command Center Finding Notification Configuration" - pubsub_topic = google_pubsub_topic.scc_notification.id + pubsub_topic = google_pubsub_topic.scc_v2_project_notification.id location = "global" streaming_config { From 67c10491d2afae823cc141e404b696bd65783430 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Thu, 18 Jul 2024 22:28:50 +0000 Subject: [PATCH 4/8] Add flag to ignore property and lint check --- mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml | 4 +++- .../resource_scc_v2_project_notification_config_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index e4c929f195b3..00e456c6e712 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -38,7 +38,9 @@ examples: topic_name: 'my-topic' config_id: 'my-config' test_env_vars: - org_id: :ORG_ID + project: :PROJECT_NAME + ignore_read_extra: + - 'location' custom_code: !ruby/object:Provider::Terraform::CustomCode custom_import: templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.erb post_create: templates/terraform/post_create/set_computed_name.erb diff --git a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go index a11ceaa61dc8..ecf2483b097f 100644 --- a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go +++ b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go @@ -12,7 +12,7 @@ func TestAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilte t.Parallel() context := map[string]interface{}{ - "project_id": envvar.GetTestProjectFromEnv(t), + "project": envvar.GetTestProjectFromEnv(), "location": "global", "random_suffix": acctest.RandString(t, 10), } From a8005af5678e41b6ffc1d59763ea07f4205fecdb Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Wed, 24 Jul 2024 23:07:03 +0000 Subject: [PATCH 5/8] Fix the test file to run --- .../securitycenterv2/ProjectNotificationConfig.yaml | 2 ++ .../scc_v2_project_notification_config_basic.tf.erb | 4 ++-- ...source_scc_v2_project_notification_config_test.go | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index 00e456c6e712..f300f446a255 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -18,6 +18,8 @@ self_link: '{{name}}' create_url: projects/{{projectId}}/locations/{location}/notificationConfigs?configId={{config_id}} update_verb: :PATCH update_mask: true +import_format: + - 'projects/{{project}}/locations/{{location}}/notificationConfigs/{{config_id}}' description: | A Cloud Security Command Center (Cloud SCC) notification configs. A notification config is a Cloud SCC resource that contains the diff --git a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb index ffb45ca9d2d0..bba2eec443b9 100644 --- a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb +++ b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.erb @@ -4,10 +4,10 @@ resource "google_pubsub_topic" "scc_v2_project_notification" { resource "google_scc_v2_project_notification_config" "<%= ctx[:primary_resource_id] %>" { config_id = "<%= ctx[:vars]['config_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" + project = "<%= ctx[:test_env_vars]['project'] %>" + location = "global" description = "My custom Cloud Security Command Center Finding Notification Configuration" pubsub_topic = google_pubsub_topic.scc_v2_project_notification.id - location = "global" streaming_config { filter = "category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"" diff --git a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go index ecf2483b097f..4bdd84ebfe94 100644 --- a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go +++ b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go @@ -3,7 +3,7 @@ package securitycenterv2_test import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" ) @@ -19,17 +19,19 @@ func TestAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilte acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckSecurityCenterV2ProjectNotificationConfigDestroyProducer(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSecurityCenterV2ProjectNotificationConfig_sccV2ProjectNotificationConfigBasicExample(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("google_scc_v2_project_notification_config.custom_notification_config", "id"), + ), }, { ResourceName: "google_scc_v2_project_notification_config.custom_notification_config", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"project", "config_id"}, + ImportStateVerifyIgnore: []string{"project", "location", "config_id"}, }, { Config: testAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilter(context), @@ -38,7 +40,7 @@ func TestAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilte ResourceName: "google_scc_v2_project_notification_config.custom_notification_config", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"project", "config_id"}, + ImportStateVerifyIgnore: []string{"project", "location", "config_id"}, }, }, }) From 7027630857883a5fdfd1767b74151ce23fe2fcd5 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Thu, 25 Jul 2024 05:48:16 +0000 Subject: [PATCH 6/8] Add flag to ignore project property --- mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml | 1 + .../resource_scc_v2_project_notification_config_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index f300f446a255..88bb850938d8 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -43,6 +43,7 @@ examples: project: :PROJECT_NAME ignore_read_extra: - 'location' + - 'project' custom_code: !ruby/object:Provider::Terraform::CustomCode custom_import: templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.erb post_create: templates/terraform/post_create/set_computed_name.erb diff --git a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go index 4bdd84ebfe94..fcfd0d53acb1 100644 --- a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go +++ b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go @@ -19,7 +19,7 @@ func TestAccSecurityCenterV2ProjectNotificationConfig_updateStreamingConfigFilte acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccSecurityCenterV2ProjectNotificationConfig_sccV2ProjectNotificationConfigBasicExample(context), From 2970d9576362553d5732dfbe66ecc9d3b61eb91e Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Fri, 2 Aug 2024 00:04:52 +0000 Subject: [PATCH 7/8] fix the failing tests after the rebase --- .../ProjectNotificationConfig.yaml | 16 ++++------------ ...ce_scc_v2_project_notification_config_test.go | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index 88bb850938d8..6171c9970984 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -13,9 +13,9 @@ --- !ruby/object:Api::Resource name: 'ProjectNotificationConfig' -base_url: projects/{{projectId}}/locations/{location}/notificationConfigs +base_url: projects/{{project}}/locations/{{location}}/notificationConfigs self_link: '{{name}}' -create_url: projects/{{projectId}}/locations/{location}/notificationConfigs?configId={{config_id}} +create_url: projects/{{project}}/locations/{{location}}/notificationConfigs?configId={{config_id}} update_verb: :PATCH update_mask: true import_format: @@ -45,17 +45,9 @@ examples: - 'location' - 'project' custom_code: !ruby/object:Provider::Terraform::CustomCode - custom_import: templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.erb + custom_import: templates/terraform/custom_import/self_link_as_name_set_project.go.erb post_create: templates/terraform/post_create/set_computed_name.erb parameters: - - !ruby/object:Api::Type::String - name: projectId - required: true - immutable: true - url_param_only: true - description: | - The project whose Cloud Security Command Center the Notification - Config lives in. - !ruby/object:Api::Type::String name: configId required: true @@ -77,7 +69,7 @@ properties: output: true description: | The resource name of this notification config, in the format - `projects/{{projectId}}/locations/{location}/notificationConfigs/{{config_id}}`. + `projects/{{projectId}}/locations/{{location}}/notificationConfigs/{{config_id}}`. - !ruby/object:Api::Type::String name: description description: | diff --git a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go index fcfd0d53acb1..d46d3b8a85ec 100644 --- a/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go +++ b/mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_notification_config_test.go @@ -54,7 +54,7 @@ resource "google_pubsub_topic" "scc_v2_project_notification" { resource "google_scc_v2_project_notification_config" "custom_notification_config" { config_id = "tf-test-my-config%{random_suffix}" - project = "%{project_id}" + project = "%{project}" description = "My custom Cloud Security Command Center Finding Notification Configuration" pubsub_topic = google_pubsub_topic.scc_v2_project_notification.id location = "global" From 5873307271b1c08db37a7c4b7f372ea5ff10bb90 Mon Sep 17 00:00:00 2001 From: Vijaykanth Melugiri Date: Tue, 6 Aug 2024 01:55:04 +0000 Subject: [PATCH 8/8] Remove the required field for pubsubtopic --- mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index 6171c9970984..fad60f931ef0 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -78,7 +78,6 @@ properties: function: 'validation.StringLenBetween(0, 1024)' - !ruby/object:Api::Type::String name: pubsubTopic - required: true description: | The Pub/Sub topic to send notifications to. Its format is "projects/[project_id]/topics/[topic]".