diff --git a/cloud/resource_cloud_environment.go b/cloud/resource_cloud_environment.go index 0b688e3..68221ac 100644 --- a/cloud/resource_cloud_environment.go +++ b/cloud/resource_cloud_environment.go @@ -27,6 +27,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const maxNameLength = 28 + func resourceCloudEnvironment() *schema.Resource { return &schema.Resource{ CreateContext: resourceCloudEnvironmentCreate, @@ -120,6 +122,10 @@ func resourceCloudEnvironmentCreate(ctx context.Context, d *schema.ResourceData, return diag.FromErr(fmt.Errorf("ERROR_INIT_CLIENT_ON_CLOUD_ENVIRONMENT: %w", err)) } + if len(name) > maxNameLength { + return diag.FromErr(fmt.Errorf("ERROR_INIT_CLIENT_ON_CLOUD_ENVIRONMENT: name must be less than %d characters", maxNameLength)) + } + cloudEnvironment := &cloudv1alpha1.CloudEnvironment{ TypeMeta: metav1.TypeMeta{ Kind: "CloudEnvironment",