mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
![]() |
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestAccDataSourceGoogleProjectOrganizationPolicy_basic(t *testing.T) {
|
||
|
project := getTestProjectFromEnv()
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
Steps: []resource.TestStep{
|
||
|
{
|
||
|
Config: testAccDataSourceGoogleProjectOrganizationPolicy_basic(project),
|
||
|
Check: testAccDataSourceGoogleOrganizationPolicyCheck(
|
||
|
"data.google_project_organization_policy.data",
|
||
|
"google_project_organization_policy.resource"),
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func testAccDataSourceGoogleProjectOrganizationPolicy_basic(project string) string {
|
||
|
return fmt.Sprintf(`
|
||
|
|
||
|
|
||
|
resource "google_project_organization_policy" "resource" {
|
||
|
project = "%s"
|
||
|
constraint = "constraints/compute.trustedImageProjects"
|
||
|
|
||
|
list_policy {
|
||
|
allow {
|
||
|
all = true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
data "google_project_organization_policy" "data" {
|
||
|
project = "%s"
|
||
|
constraint = "constraints/compute.trustedImageProjects"
|
||
|
}
|
||
|
`, project, project)
|
||
|
}
|