diff --git a/internal/schemautil/service.go b/internal/schemautil/service.go index 015f5f366..b4f1f36ce 100644 --- a/internal/schemautil/service.go +++ b/internal/schemautil/service.go @@ -76,9 +76,16 @@ func ServiceCommonSchemaWithUserConfig(kind string) map[string]*schema.Schema { // Assigns the integration types that are allowed to be set when creating a service integrations := getBootstrapIntegrationTypes(kind) - if len(integrations) > 0 { + switch len(integrations) { + case 0: + // Disables the service integrations field if there are no integrations supported + s[serviceIntegrationsKey].ValidateFunc = func(v any, _ string) ([]string, []error) { + return nil, []error{fmt.Errorf("service integration %s can't be specified here", v)} + } + default: r := s[serviceIntegrationsKey].Elem.(*schema.Resource) r.Schema["integration_type"].Description = userconfig.Desc(r.Schema["integration_type"].Description).PossibleValuesString(FlattenToString(integrations)...).Build() + r.Schema["integration_type"].ValidateFunc = validation.StringInSlice(FlattenToString(integrations), false) } return s