diff --git a/build/terraform b/build/terraform index 51a5322af585..de903bf1a7da 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 51a5322af58545ccf5fc4f53cd9a656f9e221a1c +Subproject commit de903bf1a7da3e1453940034fd0c3199ee7254a5 diff --git a/build/terraform-beta b/build/terraform-beta index 9edf009e038e..02e48b5ef850 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 9edf009e038e847cf4fffd6f60414ae25c975156 +Subproject commit 02e48b5ef85005d68b152a0387892953489ccf3e diff --git a/third_party/terraform/resources/resource_compute_instance_iam_test.go b/third_party/terraform/resources/resource_compute_instance_iam_test.go index aeb4724a9eff..e3a67b72ca46 100644 --- a/third_party/terraform/resources/resource_compute_instance_iam_test.go +++ b/third_party/terraform/resources/resource_compute_instance_iam_test.go @@ -130,7 +130,7 @@ func testAccComputeInstanceIamMember_basic(zone, instanceName, roleId string) st zone = "${google_compute_instance.test_vm.zone}" instance_name = "${google_compute_instance.test_vm.name}" role = "%s" - member = "user:admin@hashicorptest.com" + member = "user:Admin@hashicorptest.com" } `, zone, instanceName, roleId) @@ -157,7 +157,7 @@ func testAccComputeInstanceIamPolicy_basic(zone, instanceName, roleId string) st data "google_iam_policy" "foo" { binding { role = "%s" - members = ["user:admin@hashicorptest.com"] + members = ["user:Admin@hashicorptest.com"] } } @@ -194,7 +194,7 @@ func testAccComputeInstanceIamBinding_basic(zone, instanceName, roleId string) s zone = "${google_compute_instance.test_vm.zone}" instance_name = "${google_compute_instance.test_vm.name}" role = "%s" - members = ["user:admin@hashicorptest.com"] + members = ["user:Admin@hashicorptest.com"] } `, zone, instanceName, roleId) @@ -223,7 +223,7 @@ func testAccComputeInstanceIamBinding_update(zone, instanceName, roleId string) zone = "${google_compute_instance.test_vm.zone}" instance_name = "${google_compute_instance.test_vm.name}" role = "%s" - members = ["user:admin@hashicorptest.com", "user:paddy@hashicorp.com"] + members = ["user:Admin@hashicorptest.com", "user:paddy@hashicorp.com"] } `, zone, instanceName, roleId) diff --git a/third_party/terraform/resources/resource_google_project_iam_policy.go b/third_party/terraform/resources/resource_google_project_iam_policy.go index 3f2b78742db9..50090ebceaf1 100644 --- a/third_party/terraform/resources/resource_google_project_iam_policy.go +++ b/third_party/terraform/resources/resource_google_project_iam_policy.go @@ -6,6 +6,7 @@ import ( "log" "reflect" "sort" + "strings" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/schema" @@ -217,6 +218,9 @@ func derefBindings(b []*cloudresourcemanager.Binding) []cloudresourcemanager.Bin for i, v := range b { db[i] = *v + for j, m := range db[i].Members { + db[i].Members[j] = strings.ToLower(m) + } sort.Strings(db[i].Members) } return db diff --git a/third_party/terraform/resources/resource_iam_binding.go b/third_party/terraform/resources/resource_iam_binding.go index ad0225d44b82..1a6cd7ba1733 100644 --- a/third_party/terraform/resources/resource_iam_binding.go +++ b/third_party/terraform/resources/resource_iam_binding.go @@ -20,7 +20,11 @@ var iamBindingSchema = map[string]*schema.Schema{ Type: schema.TypeSet, Required: true, Elem: &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, + DiffSuppressFunc: caseDiffSuppress, + }, + Set: func(v interface{}) int { + return schema.HashString(strings.ToLower(v.(string))) }, }, "etag": { diff --git a/third_party/terraform/resources/resource_iam_member.go b/third_party/terraform/resources/resource_iam_member.go index d1a37544caec..87fcc1293ad8 100644 --- a/third_party/terraform/resources/resource_iam_member.go +++ b/third_party/terraform/resources/resource_iam_member.go @@ -17,9 +17,10 @@ var IamMemberBaseSchema = map[string]*schema.Schema{ ForceNew: true, }, "member": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: caseDiffSuppress, }, "etag": { Type: schema.TypeString, @@ -98,7 +99,7 @@ func resourceIamMemberCreate(newUpdaterFunc newResourceIamUpdaterFunc) schema.Cr if err != nil { return err } - d.SetId(updater.GetResourceId() + "/" + p.Role + "/" + p.Members[0]) + d.SetId(updater.GetResourceId() + "/" + p.Role + "/" + strings.ToLower(p.Members[0])) return resourceIamMemberRead(newUpdaterFunc)(d, meta) } } @@ -138,7 +139,7 @@ func resourceIamMemberRead(newUpdaterFunc newResourceIamUpdaterFunc) schema.Read } var member string for _, m := range binding.Members { - if m == eMember.Members[0] { + if strings.ToLower(m) == strings.ToLower(eMember.Members[0]) { member = m } } @@ -179,7 +180,7 @@ func resourceIamMemberDelete(newUpdaterFunc newResourceIamUpdaterFunc) schema.De binding := p.Bindings[bindingToRemove] memberToRemove := -1 for pos, m := range binding.Members { - if m != member.Members[0] { + if strings.ToLower(m) != strings.ToLower(member.Members[0]) { continue } memberToRemove = pos