From 4f71e36191a68153fd92d09a4228ccf09bd9bda2 Mon Sep 17 00:00:00 2001 From: Cedric <23346008+840@users.noreply.github.com> Date: Tue, 21 May 2024 15:37:10 +0200 Subject: [PATCH] Modify state upgrader to remove `ebs_volume_iops` set to zero (#3601) --- clusters/resource_cluster.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clusters/resource_cluster.go b/clusters/resource_cluster.go index 28560dea06..532da4e3da 100644 --- a/clusters/resource_cluster.go +++ b/clusters/resource_cluster.go @@ -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" @@ -39,7 +39,7 @@ func ResourceCluster() common.Resource { StateUpgraders: []schema.StateUpgrader{ { Type: clusterSchemaV0(), - Version: 2, + Version: 3, Upgrade: removeZeroAwsEbsVolumeAttributes, }, }, @@ -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")