Skip to content

Commit

Permalink
Fix (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeLeft authored Oct 21, 2024
1 parent a85f595 commit 136d94e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion celerdatabyoc/resource_classic_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, m interf
Type: cluster.ClusterModuleTypeFE,
Name: "FE",
Num: uint32(d.Get("fe_node_count").(int)),
StorageSizeGB: 50,
StorageSizeGB: 100,
InstanceType: d.Get("fe_instance_type").(string),
})

Expand Down
22 changes: 16 additions & 6 deletions celerdatabyoc/resource_elastic_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ func resourceElasticCluster() *schema.Resource {
}

m := 16 * 1000
if v > m {
if v <= 0 {
errors = append(errors, fmt.Errorf("%s`s value is invalid", k))
} else if v > m {
errors = append(errors, fmt.Errorf("%s`s value is invalid. The range of values is: [1,%d]", k, m))
}

Expand All @@ -107,10 +109,9 @@ func resourceElasticCluster() *schema.Resource {
return warnings, errors
}

if v > 24 {
if v < 1 || v > 24 {
errors = append(errors, fmt.Errorf("%s`s value is invalid. The range of values is: [1,24]", k))
}

return warnings, errors
},
},
Expand Down Expand Up @@ -306,18 +307,27 @@ func resourceElasticClusterCreate(ctx context.Context, d *schema.ResourceData, m
Type: cluster.ClusterModuleTypeFE,
Name: "FE",
Num: uint32(d.Get("coordinator_node_count").(int)),
StorageSizeGB: 50,
StorageSizeGB: 100,
InstanceType: d.Get("coordinator_node_size").(string),
})

diskNumber := 2
perDiskSize := 100
if v, ok := d.GetOk("compute_node_ebs_disk_number"); ok {
diskNumber = v.(int)
}
if v, ok := d.GetOk("compute_node_ebs_disk_per_size"); ok {
perDiskSize = v.(int)
}

clusterConf.ClusterItems = append(clusterConf.ClusterItems, &cluster.ClusterItem{
Type: cluster.ClusterModuleTypeBE,
Name: "BE",
Num: uint32(d.Get("compute_node_count").(int)),
InstanceType: d.Get("compute_node_size").(string),
DiskInfo: &cluster.DiskInfo{
Number: uint32(d.Get("compute_node_ebs_disk_number").(int)),
PerSize: uint64(d.Get("compute_node_ebs_disk_per_size").(int)),
Number: uint32(diskNumber),
PerSize: uint64(perDiskSize),
},
})

Expand Down

0 comments on commit 136d94e

Please sign in to comment.