Skip to content

Commit

Permalink
Modify state upgrader to remove ebs_volume_iops set to zero (#3601)
Browse files Browse the repository at this point in the history
  • Loading branch information
840 authored and edwardfeng-db committed May 22, 2024
1 parent 9376c58 commit 4f71e36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clusters/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const DefaultProvisionTimeout = 30 * time.Minute
const DbfsDeprecationWarning = "For init scripts use 'volumes', 'workspace' or cloud storage location instead of 'dbfs'."

var clusterSchema = resourceClusterSchema()
var clusterSchemaVersion = 3
var clusterSchemaVersion = 4

const (
numWorkerErr = "NumWorkers could be 0 only for SingleNode clusters. See https://docs.databricks.com/clusters/single-node.html for more details"
Expand All @@ -39,7 +39,7 @@ func ResourceCluster() common.Resource {
StateUpgraders: []schema.StateUpgrader{
{
Type: clusterSchemaV0(),
Version: 2,
Version: 3,
Upgrade: removeZeroAwsEbsVolumeAttributes,
},
},
Expand All @@ -65,6 +65,10 @@ func removeZeroAwsEbsVolumeAttributes(ctx context.Context, rawState map[string]i
log.Printf("[INFO] remove zero ebs_volume_count")
delete(awsAttributes, "ebs_volume_count")
}
if awsAttributes["ebs_volume_iops"] == 0 {
log.Printf("[INFO] remove zero ebs_volume_iops")
delete(awsAttributes, "ebs_volume_iops")
}
if awsAttributes["ebs_volume_size"] == 0 {
log.Printf("[INFO] remove zero ebs_volume_size")
delete(awsAttributes, "ebs_volume_size")
Expand Down

0 comments on commit 4f71e36

Please sign in to comment.