-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab2df03
commit 7b4dda8
Showing
9 changed files
with
180 additions
and
355 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
mmv1/templates/terraform/examples V2/scc_folder_mute_config_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"" | ||
} |
10 changes: 10 additions & 0 deletions
10
mmv1/templates/terraform/examples V2/scc_organization_mute_config_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"" | ||
} |
10 changes: 10 additions & 0 deletions
10
mmv1/templates/terraform/examples V2/scc_project_mute_config_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"" | ||
} |
51 changes: 51 additions & 0 deletions
51
mmv1/third_party/terraform/services/securitycenterV2/resource_scc_folder_mute_config_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
49 changes: 49 additions & 0 deletions
49
...d_party/terraform/services/securitycenterV2/resource_scc_organization_mute_config_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
Oops, something went wrong.