diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4fb5a588..0eb053647a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Already deleted `databricks_token` don't fail the apply ([#808](https://github.com/databrickslabs/terraform-provider-databricks/pull/808)) * Default `terraform-mount` clusters created for mounting for `databricks_aws_s3_mount`, `databricks_azure_adls_gen1_mount`, `databricks_azure_adls_gen2_mount`, and `databricks_azure_blob_mount` have now `spark.scheduler.mode` as `FIFO` ([#828](https://github.com/databrickslabs/terraform-provider-databricks/pull/828)) * Fixed crash when using non-Azure authentication to mount Azure resources ([#831](https://github.com/databrickslabs/terraform-provider-databricks/issues/831)) +* Fixed replacement of `instance_pool_id` in `databricks_cluster`, when `driver_instance_pool_id` was not explicitly specified ([#824](https://github.com/databrickslabs/terraform-provider-databricks/issues/824)) * Multiple documentation improvements **Deprecations** diff --git a/compute/resource_cluster.go b/compute/resource_cluster.go index ca4a3ec88f..ae4a2d3447 100644 --- a/compute/resource_cluster.go +++ b/compute/resource_cluster.go @@ -250,6 +250,17 @@ func hasClusterConfigChanged(d *schema.ResourceData) bool { return false } +// https://github.com/databrickslabs/terraform-provider-databricks/issues/824 +func fixInstancePoolChangeIfAny(d *schema.ResourceData, cluster *Cluster) { + oldInstancePool, newInstancePool := d.GetChange("instance_pool_id") + oldDriverPool, newDriverPool := d.GetChange("driver_instance_pool_id") + if oldInstancePool != newInstancePool && + oldDriverPool == oldInstancePool && + oldDriverPool == newDriverPool { + cluster.DriverInstancePoolID = cluster.InstancePoolID + } +} + func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { clusters := NewClustersAPI(ctx, c) clusterID := d.Id() @@ -266,6 +277,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, c *commo return err } modifyClusterRequest(&cluster) + fixInstancePoolChangeIfAny(d, &cluster) clusterInfo, err = clusters.Edit(cluster) if err != nil { return err