Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b639a3b
[Internal] Unified Terraform Provider: Plugin framework resources and…
tanmay-db Sep 29, 2025
6dd418d
[Internal] Unified Terraform Provider: Client bump
tanmay-db Sep 29, 2025
8c6d570
test
tanmay-db Sep 29, 2025
3b6a602
Merge branch 'bump-client' into unified-tf-plugin
tanmay-db Sep 29, 2025
09aba57
work
tanmay-db Sep 29, 2025
ca4b7df
shares
tanmay-db Sep 29, 2025
e56b678
passing tests
tanmay-db Oct 5, 2025
55d013d
-
tanmay-db Oct 6, 2025
d69e203
Merge branch 'main' of github.com:databricks/terraform-provider-datab…
tanmay-db Oct 6, 2025
c52be26
-
tanmay-db Oct 6, 2025
e2cad55
[Internal] Unified Terraform Provider: Resources and DataSources usin…
tanmay-db Oct 6, 2025
565c9f7
-
tanmay-db Oct 6, 2025
0d90f84
-
tanmay-db Oct 6, 2025
8436b01
-
tanmay-db Oct 6, 2025
62a34d1
test
tanmay-db Oct 6, 2025
a70f14a
tests
tanmay-db Oct 7, 2025
822f5e6
-
tanmay-db Oct 7, 2025
098a321
-
tanmay-db Oct 7, 2025
45ad2f5
temp
tanmay-db Oct 8, 2025
e7fbad3
-
tanmay-db Oct 12, 2025
63b50ee
Merge branch 'main' of github.com:databricks/terraform-provider-datab…
tanmay-db Oct 12, 2025
469d617
-
tanmay-db Oct 12, 2025
7bfcefd
wip
tanmay-db Oct 12, 2025
7371357
-
tanmay-db Oct 12, 2025
47c7d90
-
tanmay-db Oct 12, 2025
df0f66c
-
tanmay-db Oct 12, 2025
b9ade80
-
tanmay-db Oct 13, 2025
ce712d7
-
tanmay-db Oct 13, 2025
2256b18
-
tanmay-db Oct 13, 2025
6a2550e
-
tanmay-db Oct 13, 2025
a615f35
-
tanmay-db Oct 13, 2025
2a8e8d5
-
tanmay-db Oct 13, 2025
a855875
-
tanmay-db Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions access/resource_ip_access_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

type ipAccessListUpdateRequest struct {
common.Namespace
Label string `json:"label"`
ListType settings.ListType `json:"list_type"`
IpAddresses []string `json:"ip_addresses"`
Expand All @@ -26,12 +27,16 @@ func ResourceIPAccessList() common.Resource {
Type: schema.TypeString,
ValidateFunc: validation.Any(validation.IsIPv4Address, validation.IsCIDR),
}
common.NamespaceCustomizeSchemaMap(s)
return s
})
return common.Resource{
Schema: s,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
return common.NamespaceCustomizeDiff(d)
},
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -45,7 +50,7 @@ func ResourceIPAccessList() common.Resource {
return nil
},
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -57,7 +62,7 @@ func ResourceIPAccessList() common.Resource {
return nil
},
Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -67,7 +72,7 @@ func ResourceIPAccessList() common.Resource {
return w.IpAccessLists.Update(ctx, iacl)
},
Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions aws/data_aws_crossaccount_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// DataAwsCrossaccountPolicy defines the cross-account policy
func DataAwsCrossaccountPolicy() common.Resource {
type AwsCrossAccountPolicy struct {
common.Namespace
PolicyType string `json:"policy_type,omitempty" tf:"default:managed"`
PassRole []string `json:"pass_roles,omitempty"`
JSON string `json:"json" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions aws/data_aws_unity_catalog_assume_role_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

func DataAwsUnityCatalogAssumeRolePolicy() common.Resource {
type AwsUcAssumeRolePolicy struct {
common.Namespace
RoleName string `json:"role_name"`
UnityCatalogIamArn string `json:"unity_catalog_iam_arn,omitempty" tf:"computed"`
ExternalId string `json:"external_id"`
Expand Down
1 change: 1 addition & 0 deletions aws/data_instance_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func DataSourceInstanceProfiles() common.Resource {
IsMeta bool `json:"is_meta,omitempty" tf:"computed"`
}
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
InstanceProfiles []instanceProfileData `json:"instance_profiles,omitempty" tf:"computed"`
}, w *databricks.WorkspaceClient) error {
instanceProfiles, err := w.InstanceProfiles.ListAll(ctx)
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_instance_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

// InstanceProfileInfo contains the ARN for aws instance profiles
type InstanceProfileInfo struct {
common.Namespace
InstanceProfileArn string `json:"instance_profile_arn"`
IamRoleArn string `json:"iam_role_arn,omitempty"`
IsMetaInstanceProfile bool `json:"is_meta_instance_profile,omitempty"`
Expand Down Expand Up @@ -157,10 +158,14 @@ func ResourceInstanceProfile() common.Resource {
}
return false
}
common.NamespaceCustomizeSchemaMap(m)
return m
})
return common.Resource{
Schema: instanceProfileSchema,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
return common.NamespaceCustomizeDiff(d)
},
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
profile, err := NewInstanceProfilesAPI(ctx, c).Read(d.Id())
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions catalog/data_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceCatalog() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
Catalog *catalog.CatalogInfo `json:"catalog_info,omitempty" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_catalogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceCatalogs() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
}, w *databricks.WorkspaceClient) error {
catalogs, err := w.Catalogs.ListAll(ctx, catalog.ListCatalogsRequest{})
Expand Down
1 change: 1 addition & 0 deletions catalog/data_current_metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

func DataSourceCurrentMetastore() common.Resource {
type CurrentMetastore struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Metastore *catalog.GetMetastoreSummaryResponse `json:"metastore_info,omitempty" tf:"computed" `
}
Expand Down
1 change: 1 addition & 0 deletions catalog/data_external_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceExternalLocation() common.Resource {
type ExternalLocationByID struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
ExternalLocation *catalog.ExternalLocationInfo `json:"external_location_info,omitempty" tf:"computed" `
Expand Down
1 change: 1 addition & 0 deletions catalog/data_external_locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceExternalLocations() common.Resource {
type externalLocationsData struct {
common.Namespace
Names []string `json:"names,omitempty" tf:"computed"`
}
return common.WorkspaceData(func(ctx context.Context, data *externalLocationsData, w *databricks.WorkspaceClient) error {
Expand Down
1 change: 1 addition & 0 deletions catalog/data_metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

func DataSourceMetastore() common.Resource {
type AccountMetastoreByID struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
MetastoreId string `json:"metastore_id,omitempty" tf:"computed"`
Name string `json:"name,omitempty" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_metastores.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceMetastores() common.Resource {
type metastoresData struct {
common.Namespace
Ids map[string]string `json:"ids,omitempty" tf:"computed"`
}
return common.AccountData(func(ctx context.Context, data *metastoresData, acc *databricks.AccountClient) error {
Expand Down
1 change: 1 addition & 0 deletions catalog/data_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceSchema() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
Schema *catalog.SchemaInfo `json:"schema_info,omitempty" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceSchemas() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
CatalogName string `json:"catalog_name"`
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
}, w *databricks.WorkspaceClient) error {
Expand Down
1 change: 1 addition & 0 deletions catalog/data_storage_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceStorageCredential() common.Resource {
type AccountMetastoreByID struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
StorageCredential *catalog.StorageCredentialInfo `json:"storage_credential_info,omitempty" tf:"computed" `
Expand Down
1 change: 1 addition & 0 deletions catalog/data_storage_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceStorageCredentials() common.Resource {
type storageCredentialsData struct {
common.Namespace
Names []string `json:"names,omitempty" tf:"computed"`
}
return common.WorkspaceData(func(ctx context.Context, data *storageCredentialsData, w *databricks.WorkspaceClient) error {
Expand Down
1 change: 1 addition & 0 deletions catalog/data_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceTable() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
Table *catalog.TableInfo `json:"table_info,omitempty" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceTables() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
CatalogName string `json:"catalog_name"`
SchemaName string `json:"schema_name"`
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceViews() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
CatalogName string `json:"catalog_name"`
SchemaName string `json:"schema_name"`
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceVolume() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
Id string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
Volume *catalog.VolumeInfo `json:"volume_info,omitempty" tf:"computed"`
Expand Down
1 change: 1 addition & 0 deletions catalog/data_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func DataSourceVolumes() common.Resource {
return common.WorkspaceData(func(ctx context.Context, data *struct {
common.Namespace
CatalogName string `json:"catalog_name"`
SchemaName string `json:"schema_name"`
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
Expand Down
17 changes: 13 additions & 4 deletions catalog/resource_artifact_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

type ArtifactAllowlistInfo struct {
common.Namespace
// A list of allowed artifact match patterns.
ArtifactMatchers []catalog.ArtifactMatcher `json:"artifact_matchers" tf:"slice_set,alias:artifact_matcher"`
// The artifact type of the allowlist.
Expand All @@ -21,12 +22,17 @@ type ArtifactAllowlistInfo struct {
MetastoreId string `json:"metastore_id,omitempty" tf:"computed"`
}

func (ArtifactAllowlistInfo) CustomizeSchema(s *common.CustomizableSchema) *common.CustomizableSchema {
common.NamespaceCustomizeSchema(s)
return s
}

func ResourceArtifactAllowlist() common.Resource {
allowlistSchema := common.StructToSchema(ArtifactAllowlistInfo{}, common.NoCustomize)
allowlistSchema := common.StructToSchema(ArtifactAllowlistInfo{}, nil)
p := common.NewPairID("metastore_id", "artifact_type")

createOrUpdate := func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -53,9 +59,12 @@ func ResourceArtifactAllowlist() common.Resource {
}
return common.Resource{
Schema: allowlistSchema,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
return common.NamespaceCustomizeDiff(d)
},
Create: createOrUpdate,
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -82,7 +91,7 @@ func ResourceArtifactAllowlist() common.Resource {
},
Update: createOrUpdate,
Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand Down
18 changes: 12 additions & 6 deletions catalog/resource_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ func ucDirectoryPathSlashAndEmptySuppressDiff(k, old, new string, d *schema.Reso
return false
}

type CatalogInfo struct {
catalog.CatalogInfo
common.Namespace
}

func ResourceCatalog() common.Resource {
catalogSchema := common.StructToSchema(catalog.CatalogInfo{},
catalogSchema := common.StructToSchema(CatalogInfo{},
func(s map[string]*schema.Schema) map[string]*schema.Schema {
s["force_destroy"] = &schema.Schema{
Type: schema.TypeBool,
Expand Down Expand Up @@ -58,12 +63,13 @@ func ResourceCatalog() common.Resource {
common.CustomizeSchemaPath(s, v).SetReadOnly()
}
common.CustomizeSchemaPath(s, "effective_predictive_optimization_flag").SetComputed().SetSuppressDiff()
common.NamespaceCustomizeSchemaMap(s)
return s
})
return common.Resource{
Schema: catalogSchema,
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand Down Expand Up @@ -107,7 +113,7 @@ func ResourceCatalog() common.Resource {
return bindings.AddCurrentWorkspaceBindings(ctx, d, w, ci.Name, bindings.BindingsSecurableTypeCatalog)
},
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand All @@ -119,7 +125,7 @@ func ResourceCatalog() common.Resource {
return common.StructToData(ci, catalogSchema, d)
},
Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand Down Expand Up @@ -188,7 +194,7 @@ func ResourceCatalog() common.Resource {
return bindings.AddCurrentWorkspaceBindings(ctx, d, w, ci.Name, bindings.BindingsSecurableTypeCatalog)
},
Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
return err
}
Expand Down Expand Up @@ -242,7 +248,7 @@ func ResourceCatalog() common.Resource {
}
}
}
return nil
return common.NamespaceCustomizeDiff(d)
},
}
}
Loading
Loading