Skip to content

Commit a8c92bb

Browse files
authored
[Fix] Support updating databricks_cluster to Auto AZ (#4743)
## Changes - Cluster API now correctly returns `zone_id`, so removing `ZoneDiffSuppress` - Resolves #1700 ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] relevant change in `docs/` folder - [x] covered with integration tests in `internal/acceptance`
1 parent 10e473d commit a8c92bb

File tree

5 files changed

+4
-11
lines changed

5 files changed

+4
-11
lines changed

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bug Fixes
1010

11+
* Support updating `databricks_cluster` to Auto AZ [#4743](https://github.com/databricks/terraform-provider-databricks/pull/4743).
12+
1113
### Documentation
1214

1315
### Exporter

clusters/cluster_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func awsClusterTemplate(availability string) string {
9393
autotermination_minutes = 10
9494
aws_attributes {
9595
availability = "%s"
96+
zone_id = "auto"
9697
}
9798
custom_tags = {
9899
"Owner" = "[email protected]"

clusters/resource_cluster.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,6 @@ func SparkConfDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool
102102
return false
103103
}
104104

105-
func ZoneDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
106-
if old != "" && (new == "auto" || new == "") {
107-
log.Printf("[INFO] Suppressing diff on availability zone")
108-
return true
109-
}
110-
return false
111-
}
112-
113105
// This method is a duplicate of ModifyRequestOnInstancePool() in clusters/clusters_api.go that uses Go SDK.
114106
// Long term, ModifyRequestOnInstancePool() in clusters_api.go will be removed once all the resources using clusters are migrated to Go SDK.
115107
func ModifyRequestOnInstancePool(cluster any) error {
@@ -349,7 +341,6 @@ func (ClusterSpec) CustomizeSchema(s *common.CustomizableSchema) *common.Customi
349341
s.SchemaPath("docker_image", "basic_auth", "username").SetRequired()
350342
s.SchemaPath("spark_conf").SetCustomSuppressDiff(SparkConfDiffSuppressFunc)
351343
s.SchemaPath("aws_attributes").SetSuppressDiff().SetConflictsWith([]string{"azure_attributes", "gcp_attributes"})
352-
s.SchemaPath("aws_attributes", "zone_id").SetCustomSuppressDiff(ZoneDiffSuppress)
353344
s.SchemaPath("azure_attributes").SetSuppressDiff().SetConflictsWith([]string{"aws_attributes", "gcp_attributes"})
354345
s.SchemaPath("gcp_attributes").SetSuppressDiff().SetConflictsWith([]string{"aws_attributes", "azure_attributes"})
355346
s.SchemaPath("autoscale", "max_workers").SetOptional()

clusters/resource_cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ func TestResourceClusterUpdate_AutoAz(t *testing.T) {
14381438
AwsAttributes: &compute.AwsAttributes{
14391439
Availability: "SPOT",
14401440
FirstOnDemand: 1,
1441-
ZoneId: "us-west-2a",
1441+
ZoneId: "auto",
14421442
},
14431443
},
14441444
},

pipelines/resource_pipeline.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ func (Pipeline) CustomizeSchema(s *common.CustomizableSchema) *common.Customizab
231231
s.SchemaPath("edition").SetSuppressDiff()
232232
s.SchemaPath("channel").SetSuppressDiff()
233233
s.SchemaPath("cluster", "spark_conf").SetCustomSuppressDiff(clusters.SparkConfDiffSuppressFunc)
234-
s.SchemaPath("cluster", "aws_attributes", "zone_id").SetCustomSuppressDiff(clusters.ZoneDiffSuppress)
235234
s.SchemaPath("cluster", "autoscale", "mode").SetCustomSuppressDiff(common.EqualFoldDiffSuppress)
236235
s.SchemaPath("edition").SetCustomSuppressDiff(common.EqualFoldDiffSuppress)
237236
s.SchemaPath("storage").SetCustomSuppressDiff(suppressStorageDiff)

0 commit comments

Comments
 (0)