diff --git a/internal/pkg/strings/main.go b/internal/pkg/strings/main.go index 64b71ca..e5772d2 100644 --- a/internal/pkg/strings/main.go +++ b/internal/pkg/strings/main.go @@ -2,8 +2,8 @@ package pkg import "strings" -func StringSplitAndTrim(input string, seperator string) []string { - splittedStrings := strings.Split(input, seperator) +func StringSplitAndTrim(input string, separator string) []string { + splittedStrings := strings.Split(input, separator) for i := 0; i < len(splittedStrings); i++ { splittedStrings[i] = strings.TrimSpace(splittedStrings[i]) } diff --git a/internal/provider/resource/identity_oidc_auth.go b/internal/provider/resource/identity_oidc_auth.go index 6f187da..822edb9 100644 --- a/internal/provider/resource/identity_oidc_auth.go +++ b/internal/provider/resource/identity_oidc_auth.go @@ -231,7 +231,15 @@ func (r *IdentityOidcAuthResource) Create(ctx context.Context, req resource.Crea boundClaimsMap := make(map[string]string) for key, value := range plan.BoundClaims.Elements() { - boundClaimsMap[key] = value.(types.String).ValueString() + if strVal, ok := value.(types.String); ok { + boundClaimsMap[key] = strVal.ValueString() + } else { + resp.Diagnostics.AddError( + "Error creating identity oidc auth", + "Bound claims value is not a string", + ) + return + } } newIdentityOidcAuth, err := r.client.CreateIdentityOidcAuth(infisical.CreateIdentityOidcAuthRequest{ @@ -340,7 +348,15 @@ func (r *IdentityOidcAuthResource) Update(ctx context.Context, req resource.Upda boundClaimsMap := make(map[string]string) for key, value := range plan.BoundClaims.Elements() { - boundClaimsMap[key] = value.(types.String).ValueString() + if strVal, ok := value.(types.String); ok { + boundClaimsMap[key] = strVal.ValueString() + } else { + resp.Diagnostics.AddError( + "Error updating identity oidc auth", + "Bound claims value is not a string", + ) + return + } } updatedIdentityOidcAuth, err := r.client.UpdateIdentityOidcAuth(infisical.UpdateIdentityOidcAuthRequest{