Skip to content

Commit 191c028

Browse files
authored
add skip_validation to databricks_storage_credential (#3087)
* add `skip_validation` to `databricks_storage_credential` * add acc tests * remove azure test for now
1 parent f14198b commit 191c028

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

catalog/resource_metastore_data_access.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func adjustDataAccessSchema(m map[string]*schema.Schema) map[string]*schema.Sche
5353
Optional: true,
5454
}
5555

56+
m["skip_validation"].DiffSuppressFunc = func(k, old, new string, d *schema.ResourceData) bool {
57+
return old == "false" && new == "true"
58+
}
59+
5660
return m
5761
}
5862

catalog/resource_storage_credential.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type StorageCredentialInfo struct {
2020
DatabricksGcpServiceAccount *catalog.DatabricksGcpServiceAccountResponse `json:"databricks_gcp_service_account,omitempty" tf:"computed"`
2121
MetastoreID string `json:"metastore_id,omitempty" tf:"computed"`
2222
ReadOnly bool `json:"read_only,omitempty"`
23+
SkipValidation bool `json:"skip_validation,omitempty"`
2324
}
2425

2526
func removeGcpSaField(originalSchema map[string]*schema.Schema) map[string]*schema.Schema {

docs/resources/external_location.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ The following arguments are required:
134134

135135
In addition to all arguments above, the following attributes are exported:
136136

137-
* `id` - ID of this external location - same as `name`.
137+
- `id` - ID of this external location - same as `name`.
138138

139139
## Import
140140

docs/resources/storage_credential.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The following arguments are required:
7777
- `metastore_id` - (Required for account-level) Unique identifier of the parent Metastore. If set for workspace-level, it must match the ID of the metastore assigned to the worspace. When changing the metastore assigned to a workspace, this field becomes required.
7878
- `owner` - (Optional) Username/groupname/sp application_id of the storage credential owner.
7979
- `read_only` - (Optional) Indicates whether the storage credential is only usable for read operations.
80+
- `skip_validation` - (Optional) Suppress validation errors if any & force save the storage credential.
8081
- `force_destroy` - (Optional) Delete storage credential regardless of its dependencies.
8182

8283
`aws_iam_role` optional configuration block for credential details for AWS:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package acceptance
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
func TestUcAccStorageCredential(t *testing.T) {
9+
cloudEnv := os.Getenv("CLOUD_ENV")
10+
switch cloudEnv {
11+
case "ucws":
12+
unityWorkspaceLevel(t, step{
13+
Template: `
14+
resource "databricks_storage_credential" "external" {
15+
name = "cred-{var.RANDOM}"
16+
aws_iam_role {
17+
role_arn = "{env.TEST_METASTORE_DATA_ACCESS_ARN}"
18+
}
19+
skip_validation = true
20+
comment = "Managed by TF"
21+
}`,
22+
})
23+
case "gcp-ucws":
24+
unityWorkspaceLevel(t, step{
25+
Template: `
26+
resource "databricks_storage_credential" "external" {
27+
name = "cred-{var.RANDOM}"
28+
databricks_gcp_service_account {}
29+
skip_validation = true
30+
comment = "Managed by TF"
31+
}`,
32+
})
33+
}
34+
}

0 commit comments

Comments
 (0)