blob: 54ca95f1fcb45b640eef430778998817e59c1f4a [file] [log] [blame]
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package securitycenter_test
import (
"fmt"
"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 TestAccSecurityCenterSource_basic(t *testing.T) {
t.Parallel()
orgId := envvar.GetTestOrgFromEnv(t)
suffix := acctest.RandString(t, 10)
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccSecurityCenterSource_sccSourceBasicExample(orgId, suffix, "My description"),
},
{
ResourceName: "google_scc_source.custom_source",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccSecurityCenterSource_sccSourceBasicExample(orgId, suffix, ""),
},
{
ResourceName: "google_scc_source.custom_source",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func testAccSecurityCenterSource_sccSourceBasicExample(orgId, suffix, description string) string {
return fmt.Sprintf(`
resource "google_scc_source" "custom_source" {
display_name = "TFSrc %s"
organization = "%s"
description = "%s"
}
`, suffix, orgId, description)
}