terraform-provider-google/google/data_source_google_project_organization_policy_test.go
The Magician 78238d1ed6 update data source tests that compare lists of fields to compare all fields (#3652)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-05-20 16:11:01 -07:00

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: checkDataSourceStateMatchesResourceState(
"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 = "${google_project_organization_policy.resource.project}"
constraint = "constraints/compute.trustedImageProjects"
}
`, project)
}