-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update resource SCC Mute Config with expiry time field (#12979)
[upstream:df81d9001b56ac5a9a66a0c77e42e033562a70c2] Signed-off-by: Modular Magician <magic-modules@google.com>
- Loading branch information
1 parent
ace951b
commit ffd5a30
Showing
6 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
```release-note:bug | ||
securitycenter: added `type`, `expiry_time` field to `google_scc_mute_config` resource | ||
``` |
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
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
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
81 changes: 81 additions & 0 deletions
81
google-beta/services/securitycenter/resource_scc_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,81 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package securitycenter_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" | ||
"github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" | ||
) | ||
|
||
func TestAccSecurityCenterMuteConfig(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), | ||
ExternalProviders: map[string]resource.ExternalProvider{ | ||
"random": {}, | ||
"time": {}, | ||
}, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccSecurityCenterMuteConfig_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_scc_mute_config.default", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"mute_config_id", | ||
}, | ||
}, | ||
{ | ||
Config: testAccSecurityCenterMuteConfig_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_scc_mute_config.default", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"mute_config_id", | ||
}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccSecurityCenterMuteConfig_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_scc_mute_config" "default" { | ||
mute_config_id = "tf-test-mute-config-%{random_suffix}" | ||
parent = "organizations/%{org_id}" | ||
filter = "category: \"OS_VULNERABILITY\"" | ||
description = "A Test Mute Config" | ||
type = "DYNAMIC" | ||
expiry_time = "2215-02-03T15:01:23Z" | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccSecurityCenterMuteConfig_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_scc_mute_config" "default" { | ||
mute_config_id = "tf-test-mute-config-%{random_suffix}" | ||
parent = "organizations/%{org_id}" | ||
filter = "category: \"OS_VULNERABILITY\"" | ||
description = "An Updated Test Mute Config" | ||
type = "DYNAMIC" | ||
expiry_time = "2215-02-03T15:01:23Z" | ||
} | ||
`, context) | ||
} |
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