mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 17:46:43 +00:00
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
![]() |
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestAccGoogleOrganizationIamMember_importBasic(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
orgId := getTestOrgFromEnv(t)
|
||
|
account := acctest.RandomWithPrefix("tf-test")
|
||
|
projectId := getTestProjectFromEnv()
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
Steps: []resource.TestStep{
|
||
|
resource.TestStep{
|
||
|
Config: testAccGoogleOrganizationIamMember_basic(account, orgId),
|
||
|
},
|
||
|
|
||
|
resource.TestStep{
|
||
|
ResourceName: "google_organization_iam_member.foo",
|
||
|
ImportStateId: fmt.Sprintf("%s roles/browser serviceAccount:%s@%s.iam.gserviceaccount.com", orgId, account, projectId),
|
||
|
ImportState: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestAccGoogleOrganizationIamBinding_importBasic(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
orgId := getTestOrgFromEnv(t)
|
||
|
account := acctest.RandomWithPrefix("tf-test")
|
||
|
roleId := "tfIamTest" + acctest.RandString(10)
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
Steps: []resource.TestStep{
|
||
|
resource.TestStep{
|
||
|
Config: testAccGoogleOrganizationIamBinding_basic(account, roleId, orgId),
|
||
|
},
|
||
|
|
||
|
resource.TestStep{
|
||
|
ResourceName: "google_organization_iam_binding.foo",
|
||
|
ImportStateId: fmt.Sprintf("%s organizations/%s/roles/%s", orgId, orgId, roleId),
|
||
|
ImportState: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|