@@ -87,8 +87,10 @@ func validateDefaultTableExpirationMs(v interface{}, k string) (ws []string, err
8787}
8888
8989// bigqueryDatasetAccessHash is a custom hash function for the access block.
90- // It normalizes the 'role' field before hashing, treating legacy roles
91- // and their modern IAM equivalents as the same.
90+ // It normalizes
91+ // 1) the 'role' field before hashing, treating legacy roles
92+ // and their modern IAM equivalents as the same,
93+ // 2) the 'user_by_email' and 'group_by_email' fields to be case-insensitive.
9294func resourceBigqueryDatasetAccessHash (v interface {}) int {
9395 m , ok := v .(map [string ]interface {})
9496 if ! ok {
@@ -100,6 +102,14 @@ func resourceBigqueryDatasetAccessHash(v interface{}) int {
100102 copy [k ] = val
101103 }
102104
105+ // Normalize user_by_email and group_by_email to be case-insensitive
106+ if email , ok := copy ["user_by_email" ].(string ); ok && email != "" {
107+ copy ["user_by_email" ] = strings .ToLower (email )
108+ }
109+ if email , ok := copy ["group_by_email" ].(string ); ok && email != "" {
110+ copy ["group_by_email" ] = strings .ToLower (email )
111+ }
112+
103113 // Normalize the role if it exists and matches a legacy role.
104114 if role , ok := copy ["role" ].(string ); ok {
105115 if newRole , ok := bigqueryDatasetAccessPrimitiveToRoleMap [role ]; ok {
@@ -1142,7 +1152,11 @@ func flattenBigQueryDatasetAccessDomain(v interface{}, d *schema.ResourceData, c
11421152}
11431153
11441154func flattenBigQueryDatasetAccessGroupByEmail (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1145- return v
1155+ if v == nil {
1156+ return nil
1157+ }
1158+
1159+ return strings .ToLower (v .(string ))
11461160}
11471161
11481162func flattenBigQueryDatasetAccessRole (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -1158,7 +1172,11 @@ func flattenBigQueryDatasetAccessIamMember(v interface{}, d *schema.ResourceData
11581172}
11591173
11601174func flattenBigQueryDatasetAccessUserByEmail (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1161- return v
1175+ if v == nil {
1176+ return nil
1177+ }
1178+
1179+ return strings .ToLower (v .(string ))
11621180}
11631181
11641182func flattenBigQueryDatasetAccessView (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -1614,7 +1632,11 @@ func expandBigQueryDatasetAccessDomain(v interface{}, d tpgresource.TerraformRes
16141632}
16151633
16161634func expandBigQueryDatasetAccessGroupByEmail (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1617- return v , nil
1635+ if v == nil {
1636+ return nil , nil
1637+ }
1638+
1639+ return strings .ToLower (v .(string )), nil
16181640}
16191641
16201642func expandBigQueryDatasetAccessRole (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
@@ -1630,7 +1652,11 @@ func expandBigQueryDatasetAccessIamMember(v interface{}, d tpgresource.Terraform
16301652}
16311653
16321654func expandBigQueryDatasetAccessUserByEmail (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1633- return v , nil
1655+ if v == nil {
1656+ return nil , nil
1657+ }
1658+
1659+ return strings .ToLower (v .(string )), nil
16341660}
16351661
16361662func expandBigQueryDatasetAccessView (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
0 commit comments