diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 0d77d7f4f6..fcc211962e 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -21,4 +21,6 @@ * Initial support for resources implemented with plugin framework ([#5176](https://github.com/databricks/terraform-provider-databricks/pull/5176)). ### Internal Changes + +* Decouple library schema used in cluster resource with library resource ([#5189](https://github.com/databricks/terraform-provider-databricks/pull/5189)). * Add client support in CustomizeDiff for SDKv2 resources and data sources ([#5171](https://github.com/databricks/terraform-provider-databricks/pull/5171)). diff --git a/clusters/resource_cluster.go b/clusters/resource_cluster.go index 534fdb90cf..1186e0fae4 100644 --- a/clusters/resource_cluster.go +++ b/clusters/resource_cluster.go @@ -722,5 +722,5 @@ func resourceClusterDelete(ctx context.Context, d *schema.ResourceData, c *commo func init() { common.RegisterResourceProvider(compute.ClusterSpec{}, ClusterSpec{}) - common.RegisterResourceProvider(compute.Library{}, LibraryResource{}) + common.RegisterResourceProvider(compute.Library{}, LibraryResourceWithoutNamespace{}) } diff --git a/clusters/resource_library.go b/clusters/resource_library.go index 296247c535..b8f3d4df83 100644 --- a/clusters/resource_library.go +++ b/clusters/resource_library.go @@ -13,6 +13,23 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) +type LibraryResourceWithoutNamespace struct { + compute.Library +} + +func (LibraryResourceWithoutNamespace) CustomizeSchemaResourceSpecific(s *common.CustomizableSchema) *common.CustomizableSchema { + s.AddNewField("cluster_id", &schema.Schema{ + Type: schema.TypeString, + Required: true, + }) + return s +} + +func (LibraryResourceWithoutNamespace) CustomizeSchema(s *common.CustomizableSchema) *common.CustomizableSchema { + s.SchemaPath("egg").SetDeprecated(EggDeprecationWarning) + return s +} + type LibraryResource struct { compute.Library common.Namespace