diff --git a/client/karbon/karbon_private_registry_structs.go b/client/karbon/karbon_private_registry_structs.go index 5e588bea7..59b85c81a 100644 --- a/client/karbon/karbon_private_registry_structs.go +++ b/client/karbon/karbon_private_registry_structs.go @@ -3,24 +3,24 @@ package karbon type PrivateRegistryListResponse []PrivateRegistryResponse type PrivateRegistryResponse struct { - Name *string `json:"name" mapstructure:"name, omitempty"` - Endpoint *string `json:"endpoint" mapstructure:"endpoint, omitempty"` - UUID *string `json:"uuid" mapstructure:"uuid, omitempty"` + Name *string `json:"name" mapstructure:"name,omitempty"` + Endpoint *string `json:"endpoint" mapstructure:"endpoint,omitempty"` + UUID *string `json:"uuid" mapstructure:"uuid,omitempty"` } type PrivateRegistryIntentInput struct { - Name *string `json:"name" mapstructure:"name, omitempty"` - Cert *string `json:"cert" mapstructure:"cert, omitempty"` - URL *string `json:"url" mapstructure:"url, omitempty"` - Port *int64 `json:"port" mapstructure:"port, omitempty"` - Username *string `json:"username" mapstructure:"username, omitempty"` - Password *string `json:"password" mapstructure:"password, omitempty"` + Name *string `json:"name" mapstructure:"name,omitempty"` + Cert *string `json:"cert" mapstructure:"cert,omitempty"` + URL *string `json:"url" mapstructure:"url,omitempty"` + Port *int64 `json:"port,omitempty" mapstructure:"port,omitempty"` + Username *string `json:"username,omitempty" mapstructure:"username,omitempty"` + Password *string `json:"password,omitempty" mapstructure:"password,omitempty"` } type PrivateRegistryOperationResponse struct { - RegistryName *string `json:"registry_name" mapstructure:"registry_name, omitempty"` + RegistryName *string `json:"registry_name" mapstructure:"registry_name,omitempty"` } type PrivateRegistryOperationIntentInput struct { - RegistryName *string `json:"registry_name" mapstructure:"registry_name, omitempty"` + RegistryName *string `json:"registry_name" mapstructure:"registry_name,omitempty"` } diff --git a/nutanix/resource_nutanix_karbon_private_registry.go b/nutanix/resource_nutanix_karbon_private_registry.go index 7cb8b4ed5..87c6d573c 100644 --- a/nutanix/resource_nutanix_karbon_private_registry.go +++ b/nutanix/resource_nutanix_karbon_private_registry.go @@ -46,7 +46,7 @@ func KarbonPrivateRegistryResourceMap() map[string]*schema.Schema { }, "port": { Type: schema.TypeInt, - Required: true, + Optional: true, ValidateFunc: validation.IntAtLeast(1), }, "endpoint": { @@ -87,7 +87,7 @@ func resourceNutanixKarbonPrivateRegistryCreate(ctx context.Context, d *schema.R } else { return diag.Errorf("error occurred during private registry creation: url must be set") } - if port, ok := d.GetOk("port"); ok { + if port, ok := d.GetOk("port"); ok && port.(int) > 0 { p := int64(port.(int)) karbonPrivateRegistry.Port = &p }