Skip to content

Commit

Permalink
V2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thokalavinod committed May 22, 2024
1 parent ab2df03 commit 7b4dda8
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 355 deletions.
129 changes: 0 additions & 129 deletions mmv1/products/securitycenterv2/NotificationConfig.yaml

This file was deleted.

91 changes: 0 additions & 91 deletions mmv1/products/securitycenterv2/Source.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_pubsub_topic" "scc_folder_mute_config" {
name = "<%= ctx[:vars]['topic_name'] %>"
}

resource "google_scc_folder_mute_config_v2" "<%= ctx[:primary_resource_id] %>" {
mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>"
folder = "<%= ctx[:test_env_vars]['folder_id'] %>"
description = "My custom Cloud Security Command Center Mute Configuration"
filter = "severity = \"HIGH\""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_pubsub_topic" "scc_folder_mute_config" {
name = "<%= ctx[:vars]['topic_name'] %>"
}

resource "google_scc_folder_mute_config_v2" "<%= ctx[:primary_resource_id] %>" {
mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>"
folder = "<%= ctx[:test_env_vars]['folder_id'] %>"
description = "My custom Cloud Security Command Center Mute Configuration"
filter = "severity = \"HIGH\""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_pubsub_topic" "scc_folder_mute_config" {
name = "<%= ctx[:vars]['topic_name'] %>"
}

resource "google_scc_folder_mute_config_v2" "<%= ctx[:primary_resource_id] %>" {
mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>"
folder = "<%= ctx[:test_env_vars]['folder_id'] %>"
description = "My custom Cloud Security Command Center Mute Configuration"
filter = "severity = \"HIGH\""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package securitycenter_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 TestAccSecurityCenterFolderMuteConfig_basic(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"org_id": envvar.GetTestOrgFromEnv(t),
"folder_id": acctest.RandString(t, 10),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck:func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy:testAccCheckSecurityCenterFolderMuteConfigDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccSecurityCenterFolderMuteConfig_basic(context),
},
{
ResourceName:"google_scc_folder_mute_config.default",
ImportState:true,
ImportStateVerify:true,
ImportStateVerifyIgnore: []string{
"parent",
"foldermuteConfigId",
},
},
},
})
}

func testAccSecurityCenterFolderMuteConfig_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_scc_folder_mute_config" "default" {
foldermuteConfigId = "tf-test-my-config%{random_suffix}"
location = "us-central1"
parent = "folders/%{folder_id}"
description = "A test folder mute config"
filter = "severity = \"LOW\""
}
`, context)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package securitycenter_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 TestAccSecurityCenterOrganizationMuteConfig_basic(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"org_id": envvar.GetTestOrgFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck:func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy:testAccCheckSecurityCenterOrganizationMuteConfigDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccSecurityCenterOrganizationMuteConfig_basic(context),
},
{
ResourceName:"google_scc_organization_mute_config.default",
ImportState:true,
ImportStateVerify:true,
ImportStateVerifyIgnore: []string{
"parent",
"organizationmuteConfigId",
},
},
},
})
}

func testAccSecurityCenterOrganizationMuteConfig_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_scc_organization_mute_config" "default" {
organizationmuteConfigId = "tf-test-my-config%{random_suffix}"
parent = "organizations/%{org_id}"
description = "A test organization mute config"
filter = "resource_name = \"projects/my-project/resource-type/findings\""
}
`, context)
}
Loading

0 comments on commit 7b4dda8

Please sign in to comment.