mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-05 17:52:38 +00:00
Test adding multiple bindings at once.
This commit is contained in:
parent
78545359bd
commit
f88e0429c7
|
@ -39,7 +39,7 @@ func TestAccGoogleProjectIamBinding_basic(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
// Test that multiple IAM bindings can be applied to a project
|
||||
// Test that multiple IAM bindings can be applied to a project, one at a time
|
||||
func TestAccGoogleProjectIamBinding_multiple(t *testing.T) {
|
||||
pid := "terraform-" + acctest.RandString(10)
|
||||
resource.Test(t, resource.TestCase{
|
||||
|
@ -71,6 +71,42 @@ func TestAccGoogleProjectIamBinding_multiple(t *testing.T) {
|
|||
Role: "roles/viewer",
|
||||
Members: []string{"user:paddy@hashicorp.com"},
|
||||
}, pid),
|
||||
testAccCheckGoogleProjectIamBindingExists("google_project_iam_binding.multiple", &cloudresourcemanager.Binding{
|
||||
Role: "roles/compute.instanceAdmin",
|
||||
Members: []string{"user:admin@hashicorptest.com"},
|
||||
}, pid),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// Test that multiple IAM bindings can be applied to a project all at once
|
||||
func TestAccGoogleProjectIamBinding_basic(t *testing.T) {
|
||||
pid := "terraform-" + acctest.RandString(10)
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
// Create a new project
|
||||
{
|
||||
Config: testAccGoogleProject_create(pid, pname, org),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccGoogleProjectExistingPolicy(pid),
|
||||
),
|
||||
},
|
||||
// Apply an IAM binding
|
||||
{
|
||||
Config: testAccGoogleProjectAssociateBindingMultiple(pid, pname, org),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckGoogleProjectIamBindingExists("google_project_iam_binding.acceptance", &cloudresourcemanager.Binding{
|
||||
Role: "roles/compute.instanceAdmin",
|
||||
Members: []string{"user:admin@hashicorptest.com"},
|
||||
}, pid),
|
||||
testAccCheckGoogleProjectIamBindingExists("google_project_iam_binding.multiple", &cloudresourcemanager.Binding{
|
||||
Role: "roles/compute.instanceAdmin",
|
||||
Members: []string{"user:admin@hashicorptest.com"},
|
||||
}, pid),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user