diff --git a/spacelift/provider.go b/spacelift/provider.go index e7cc54ee..5425ccb0 100644 --- a/spacelift/provider.go +++ b/spacelift/provider.go @@ -227,12 +227,8 @@ func buildClientFromAPIKeyData(d *schema.ResourceData) (*internal.Client, error) // Since validation runs first, we can safely assume that the data is there. // Handle / at api_key_endpoint - endpoint := d.Get("api_key_endpoint").(string) - if endpoint[len(api_key_endpoint)-1:] == "/" { - endpoint = fmt.Sprintf("%sgraphql", endpoint) - } else { - endpoint = fmt.Sprintf("%s/graphql", endpoint) - } + endpoint := strings.TrimSuffix(d.Get("api_key_endpoint").(string), "/") + endpiont = fmt.Sprintf("%s/graphql", endpoint) apiKeyID := d.Get("api_key_id").(string) apiKeySecret := d.Get("api_key_secret").(string)