Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardfeng-db committed Jan 8, 2024
1 parent b81613c commit 39a8b24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions clusters/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ func (ClusterResourceProvider) Aliases() map[string]string {
}

func (ClusterResourceProvider) CustomizeSchema(s map[string]*schema.Schema) map[string]*schema.Schema {
common.CustomizeSchemaPath(s, "enable_elastic_disk").SetReadOnly()
common.CustomizeSchemaPath(s, "enable_local_disk_encryption").SetReadOnly()
common.CustomizeSchemaPath(s, "node_type_id").SetReadOnly().SetConflictsWith([]string{"driver_instance_pool_id", "instance_pool_id"})
common.CustomizeSchemaPath(s, "driver_node_type_id").SetReadOnly().SetConflictsWith([]string{"driver_instance_pool_id", "instance_pool_id"})
common.CustomizeSchemaPath(s, "driver_instance_pool_id").SetReadOnly().SetConflictsWith([]string{"driver_node_type_id", "node_type_id"})
common.CustomizeSchemaPath(s, "enable_elastic_disk").SetOptional().SetComputed()
common.CustomizeSchemaPath(s, "enable_local_disk_encryption").SetOptional().SetComputed()
common.CustomizeSchemaPath(s, "node_type_id").SetComputed().SetOptional().SetConflictsWith([]string{"driver_instance_pool_id", "instance_pool_id"})
common.CustomizeSchemaPath(s, "driver_node_type_id").SetComputed().SetOptional().SetConflictsWith([]string{"driver_instance_pool_id", "instance_pool_id"})
common.CustomizeSchemaPath(s, "driver_instance_pool_id").SetComputed().SetOptional().SetConflictsWith([]string{"driver_node_type_id", "node_type_id"})
common.CustomizeSchemaPath(s, "ssh_public_keys").SetMaxItems(10)
common.CustomizeSchemaPath(s, "init_scripts").SetMaxItems(10).AddNewField("abfss", common.StructToSchema(InitScriptStorageInfo{}, func(ss map[string]*schema.Schema) map[string]*schema.Schema {
return ss
Expand Down Expand Up @@ -132,7 +132,7 @@ func (ClusterResourceProvider) CustomizeSchema(s map[string]*schema.Schema) map[
common.CustomizeSchemaPath(s, "cluster_log_conf", "dbfs", "destination").SetRequired()
common.CustomizeSchemaPath(s, "cluster_log_conf", "s3", "destination").SetRequired()
common.CustomizeSchemaPath(s, "spark_version").SetRequired()
common.CustomizeSchemaPath(s, "cluster_id").SetReadOnly()
common.CustomizeSchemaPath(s, "cluster_id").SetOptional().SetComputed()
common.CustomizeSchemaPath(s, "instance_pool_id").SetConflictsWith([]string{"driver_node_type_id", "node_type_id"})
common.CustomizeSchemaPath(s, "runtime_engine").SetValidateFunc(validation.StringInSlice([]string{"PHOTON", "STANDARD"}, false))
s["is_pinned"] = &schema.Schema{
Expand Down
5 changes: 5 additions & 0 deletions common/reflect_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ func (s *CustomizableSchema) SetOptional() *CustomizableSchema {
return s
}

func (s *CustomizableSchema) SetComputed() *CustomizableSchema {
s.Schema.Computed = true
return s
}

func (s *CustomizableSchema) SetDefault(value any) *CustomizableSchema {
s.Schema.Default = value
s.Schema.Optional = true
Expand Down

0 comments on commit 39a8b24

Please sign in to comment.