diff --git a/internal/sdkprovider/service/account/account_team_member.go b/internal/sdkprovider/service/account/account_team_member.go index 0b7a010e5..1891bfed1 100644 --- a/internal/sdkprovider/service/account/account_team_member.go +++ b/internal/sdkprovider/service/account/account_team_member.go @@ -3,6 +3,7 @@ package account import ( "context" "log" + "strings" "github.com/aiven/aiven-go-client/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -76,7 +77,7 @@ func resourceAccountTeamMemberCreate(ctx context.Context, d *schema.ResourceData client := m.(*aiven.Client) accountID := d.Get("account_id").(string) teamID := d.Get("team_id").(string) - userEmail := d.Get("user_email").(string) + userEmail := strings.ToLower(d.Get("user_email").(string)) err := client.AccountTeamMembers.Invite( ctx, diff --git a/internal/sdkprovider/service/account/account_team_member_data_source.go b/internal/sdkprovider/service/account/account_team_member_data_source.go index a4c0b770a..536d3e2c1 100644 --- a/internal/sdkprovider/service/account/account_team_member_data_source.go +++ b/internal/sdkprovider/service/account/account_team_member_data_source.go @@ -2,6 +2,7 @@ package account import ( "context" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -21,7 +22,7 @@ func DatasourceAccountTeamMember() *schema.Resource { func datasourceAccountTeamMemberRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { accountID := d.Get("account_id").(string) teamID := d.Get("team_id").(string) - userEmail := d.Get("user_email").(string) + userEmail := strings.ToLower(d.Get("user_email").(string)) d.SetId(schemautil.BuildResourceID(accountID, teamID, userEmail)) diff --git a/internal/sdkprovider/service/organization/organization_user.go b/internal/sdkprovider/service/organization/organization_user.go index 60e75f62f..22e89a1d6 100644 --- a/internal/sdkprovider/service/organization/organization_user.go +++ b/internal/sdkprovider/service/organization/organization_user.go @@ -3,6 +3,7 @@ package organization import ( "context" "log" + "strings" "github.com/aiven/aiven-go-client/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -70,7 +71,7 @@ eliminate the member from the organization if one has accepted an invitation pre func resourceOrganizationUserCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { client := m.(*aiven.Client) organizationID := d.Get("organization_id").(string) - userEmail := d.Get("user_email").(string) + userEmail := strings.ToLower(d.Get("user_email").(string)) err := client.OrganizationUserInvitations.Invite(ctx, organizationID, aiven.OrganizationUserInvitationAddRequest{ UserEmail: userEmail, diff --git a/internal/sdkprovider/service/organization/organization_user_data_source.go b/internal/sdkprovider/service/organization/organization_user_data_source.go index 85c341ab8..f760bb64c 100644 --- a/internal/sdkprovider/service/organization/organization_user_data_source.go +++ b/internal/sdkprovider/service/organization/organization_user_data_source.go @@ -2,6 +2,7 @@ package organization import ( "context" + "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -22,7 +23,7 @@ func DatasourceOrganizationUser() *schema.Resource { func datasourceOrganizationUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { organizationID := d.Get("organization_id").(string) - userEmail := d.Get("user_email").(string) + userEmail := strings.ToLower(d.Get("user_email").(string)) d.SetId(schemautil.BuildResourceID(organizationID, userEmail)) diff --git a/internal/sdkprovider/service/project/project_user.go b/internal/sdkprovider/service/project/project_user.go index 7480f0bb3..0dc6deaf6 100644 --- a/internal/sdkprovider/service/project/project_user.go +++ b/internal/sdkprovider/service/project/project_user.go @@ -62,7 +62,7 @@ func isProjectUserAlreadyInvited(err error) bool { func resourceProjectUserCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { client := m.(*aiven.Client) projectName := d.Get("project").(string) - email := d.Get("email").(string) + email := strings.ToLower(d.Get("email").(string)) err := client.ProjectUsers.Invite( ctx, projectName, diff --git a/internal/sdkprovider/service/project/project_user_data_source.go b/internal/sdkprovider/service/project/project_user_data_source.go index 3e2228dbe..6146c08bb 100644 --- a/internal/sdkprovider/service/project/project_user_data_source.go +++ b/internal/sdkprovider/service/project/project_user_data_source.go @@ -2,6 +2,7 @@ package project import ( "context" + "strings" "github.com/aiven/aiven-go-client/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -23,7 +24,7 @@ func datasourceProjectUserRead(ctx context.Context, d *schema.ResourceData, m in client := m.(*aiven.Client) projectName := d.Get("project").(string) - email := d.Get("email").(string) + email := strings.ToLower(d.Get("email").(string)) users, invitations, err := client.ProjectUsers.List(ctx, projectName) if err != nil {