Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ internal/providers/pluginfw/tfschema/single_nested_attribute.go linguist-generat
internal/providers/pluginfw/tfschema/single_nested_block.go linguist-generated=true
internal/providers/pluginfw/tfschema/string_attribute.go linguist-generated=true
internal/providers/pluginfw/tfschema/struct_to_schema.go linguist-generated=true
internal/providers/pluginfw/tfschema/unified_provider.go linguist-generated=true
internal/service/agentbricks_tf/legacy_model.go linguist-generated=true
internal/service/agentbricks_tf/model.go linguist-generated=true
internal/service/apps_tf/legacy_model.go linguist-generated=true
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/next-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ name: Check for NEXT_CHANGELOG.md Changes
on:
# Use pull_request_target to have access to GitHub API
pull_request_target:
types: [opened, synchronize, reopened, edited]

jobs:
check-next-changelog:
# Allow Dependabot PRs to pass without a changelog entry
if: github.actor != 'dependabot[bot]'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Fetch list of changed files
id: changed-files
Expand Down
11 changes: 11 additions & 0 deletions access/sql_permissions_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ func TestAccSqlPermissions_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccSqlPermissions_ProviderConfig_Required(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: sqlPermissionsProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccSqlPermissions_ProviderConfig_EmptyID(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: sqlPermissionsProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions aws/instance_profile_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ func TestAccInstanceProfile_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccInstanceProfile_ProviderConfig_Required(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: instanceProfileProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccInstanceProfile_ProviderConfig_EmptyID(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: instanceProfileProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions aws/service_principal_role_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ func TestAccServicePrincipalRole_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccServicePrincipalRole_ProviderConfig_Required(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: servicePrincipalRoleProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccServicePrincipalRole_ProviderConfig_EmptyID(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: servicePrincipalRoleProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions aws/user_role_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ func TestAccUserRole_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccUserRole_ProviderConfig_Required(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: userRoleProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccUserRole_ProviderConfig_EmptyID(t *testing.T) {
acceptance.WorkspaceLevel(t, acceptance.Step{
Template: userRoleProviderConfigTemplate(`
Expand Down
17 changes: 14 additions & 3 deletions catalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,17 @@ func TestAccCatalog_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccCatalog_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: catalogProviderConfigTemplate("test_catalog_{var.STICKY_RANDOM}", `
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccCatalog_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: catalogProviderConfigTemplate("test_catalog_{var.STICKY_RANDOM}", `
Expand Down Expand Up @@ -313,7 +324,7 @@ func TestAccCatalog_ProviderConfig_Match(t *testing.T) {
`, workspaceIDStr)),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionNoop),
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionUpdate),
},
},
})
Expand Down Expand Up @@ -343,7 +354,7 @@ func TestAccCatalog_ProviderConfig_Recreate(t *testing.T) {
`),
ConfigPlanChecks: resource.ConfigPlanChecks{
PostApplyPreRefresh: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionDestroyBeforeCreate),
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionUpdate),
},
},
PlanOnly: true,
Expand Down Expand Up @@ -371,7 +382,7 @@ func TestAccCatalog_ProviderConfig_Remove(t *testing.T) {
Template: catalogProviderConfigTemplate(catalogName, ""),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionNoop),
plancheck.ExpectResourceAction("databricks_catalog.this", plancheck.ResourceActionUpdate),
},
},
})
Expand Down
11 changes: 11 additions & 0 deletions catalog/credential_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ func TestAccCredential_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccCredential_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: credentialProviderConfigTemplate("tf-test-cred-{var.STICKY_RANDOM}", `
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccCredential_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: credentialProviderConfigTemplate("tf-test-cred-{var.STICKY_RANDOM}", `
Expand Down
11 changes: 11 additions & 0 deletions catalog/grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ func TestUcAccGrant_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestUcAccGrant_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: grantProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestUcAccGrant_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: grantProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions catalog/grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ func TestUcAccGrants_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestUcAccGrants_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: grantsProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestUcAccGrants_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: grantsProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions catalog/metastore_assignment_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ func TestAccMetastoreAssignment_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccMetastoreAssignment_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreAssignmentProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccMetastoreAssignment_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreAssignmentProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions catalog/metastore_data_access_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ func TestAccMetastoreDataAccess_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccMetastoreDataAccess_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreDataAccessProviderConfigTemplate(`
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccMetastoreDataAccess_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreDataAccessProviderConfigTemplate(`
Expand Down
11 changes: 11 additions & 0 deletions catalog/metastore_provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ func TestAccMetastore_ProviderConfig_Invalid(t *testing.T) {
})
}

func TestAccMetastore_ProviderConfig_Required(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreProviderConfigTemplate("tf-test-metastore-{var.STICKY_RANDOM}", `
provider_config {
}
`),
ExpectError: regexp.MustCompile(`The argument "workspace_id" is required, but no definition was found.`),
PlanOnly: true,
})
}

func TestAccMetastore_ProviderConfig_EmptyID(t *testing.T) {
acceptance.UnityWorkspaceLevel(t, acceptance.Step{
Template: metastoreProviderConfigTemplate("tf-test-metastore-{var.STICKY_RANDOM}", `
Expand Down
5 changes: 2 additions & 3 deletions catalog/resource_artifact_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ func ResourceArtifactAllowlist() common.Resource {
return nil
}
return common.Resource{
Schema: allowlistSchema,
CustomizeDiff: common.NamespaceCustomizeDiffNoForceNew,
Create: createOrUpdate,
Schema: allowlistSchema,
Create: createOrUpdate,
Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions catalog/resource_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,6 @@ func ResourceCatalog() common.Resource {
return w.Catalogs.Delete(ctx, catalog.DeleteCatalogRequest{Force: force, Name: d.Id()})
},
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
// Catalogs are metastore-scoped: they live in a metastore, not in a
// specific workspace. When the effective workspace_id changes, switch
// API routing to the new workspace and persist the new value to state
// without recreating the catalog.
if err := common.NamespaceCustomizeDiffNoForceNew(ctx, d, c); err != nil {
return err
}
// The only scenario in which we can update options is for the `authorized_paths` key. Any
// other changes to the options field will result in an error.
if d.HasChange("options") {
Expand Down
3 changes: 1 addition & 2 deletions catalog/resource_catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,7 @@ func TestCatalogSuppressCaseSensitivity(t *testing.T) {
"storage_location": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
"provisioning_info.#": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
"effective_predictive_optimization_flag.#": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
"full_name": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
"provider_config.#": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
"full_name": {Old: "", New: "", NewComputed: true, NewRemoved: false, RequiresNew: false, Sensitive: false},
},
HCL: `
name = "A"
Expand Down
3 changes: 1 addition & 2 deletions catalog/resource_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ func ResourceConnection() common.Resource {
return s
})
return common.Resource{
Schema: s,
CustomizeDiff: common.NamespaceCustomizeDiffNoForceNew,
Schema: s,
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ResourceCredential() common.Resource {
return common.Resource{
Schema: credentialSchema,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
return common.NamespaceCustomizeDiffNoForceNew(ctx, d, c)
return common.NamespaceCustomizeDiff(ctx, d, c)
},
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
Expand Down
3 changes: 1 addition & 2 deletions catalog/resource_external_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ func ResourceExternalLocation() common.Resource {
return m
})
return common.Resource{
Schema: s,
CustomizeDiff: common.NamespaceCustomizeDiffNoForceNew,
Schema: s,
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions catalog/resource_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ func ResourceGrant() common.Resource {
})

return common.Resource{
Schema: s,
CustomizeDiff: common.NamespaceCustomizeDiffNoForceNew,
Schema: s,
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func TestResourceGrantReadHonorsProviderConfig(t *testing.T) {
workspace_id = "123456"
}
`,
}.ExpectError(t, `failed to validate workspace_id: workspace_id mismatch: provider is configured for workspace 12345 but got 123456 in provider_config. please check the workspace_id provided in provider_config`)
}.ExpectError(t, `failed to validate workspace_id: failed to get the workspace_id: strconv.ParseInt: parsing "": invalid syntax`)
}

func TestResourceGrantRead(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions catalog/resource_grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ func ResourceGrants() common.Resource {
return s
})
return common.Resource{
Schema: s,
CustomizeDiff: common.NamespaceCustomizeDiffNoForceNew,
Schema: s,
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClientUnifiedProvider(ctx, d)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestGrantsReadHonorsProviderConfig(t *testing.T) {
workspace_id = "123456"
}
`,
}.ExpectError(t, `failed to validate workspace_id: workspace_id mismatch: provider is configured for workspace 12345 but got 123456 in provider_config. please check the workspace_id provided in provider_config`)
}.ExpectError(t, `failed to validate workspace_id: failed to get the workspace_id: strconv.ParseInt: parsing "": invalid syntax`)
}

func TestGrantsRead(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ResourceMetastore() common.Resource {
IsDual: true,
Schema: s,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
return common.CustomizeDiffDualResourcesNoForceNew(ctx, d, c)
return common.CustomizeDiffDualResources(ctx, d, c)
},
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
c, err := c.DatabricksClientForDualResource(ctx, d)
Expand Down
9 changes: 4 additions & 5 deletions catalog/resource_metastore_api_field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ func TestCreateMetastore_ApiFieldWorkspace(t *testing.T) {
Name: "a",
}, nil)
},
Resource: ResourceMetastore(),
AccountID: "100",
ProviderWorkspaceID: "12345",
Host: "https://accounts.cloud.databricks.com",
Create: true,
Resource: ResourceMetastore(),
AccountID: "100",
Host: "https://accounts.cloud.databricks.com",
Create: true,
HCL: `
name = "a"
storage_root = "s3://b"
Expand Down
2 changes: 1 addition & 1 deletion catalog/resource_metastore_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func ResourceMetastoreAssignment() common.Resource {
IsDual: true,
Schema: s,
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
return common.CustomizeDiffDualResourcesNoForceNew(ctx, d, c)
return common.CustomizeDiffDualResources(ctx, d, c)
},
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
c, err := c.DatabricksClientForDualResource(ctx, d)
Expand Down
Loading
Loading