Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nkvuong committed Nov 15, 2024
1 parent c21c310 commit bcfacea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions catalog/resource_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ var credentialSchema = common.StructToSchema(catalog.CredentialInfo{},
}

for _, required := range []string{"name", "purpose"} {
common.MustSchemaPath(m, required).Required = true
common.MustSchemaPath(m, required).Optional = false
common.CustomizeSchemaPath(m, required).SetRequired()
}

for _, computed := range []string{"id", "created_at", "created_by", "full_name", "isolation_mode", "metastore_id", "owner", "updated_at", "updated_by"} {
common.CustomizeSchemaPath(m, computed).SetComputed()
}

common.MustSchemaPath(m, "id").Computed = true
common.MustSchemaPath(m, "aws_iam_role", "external_id").Computed = true
common.MustSchemaPath(m, "aws_iam_role", "unity_catalog_iam_arn").Computed = true
common.MustSchemaPath(m, "azure_managed_identity", "credential_id").Computed = true
Expand Down Expand Up @@ -136,7 +138,7 @@ func ResourceCredential() common.Resource {
}
return err
}
// Bind the current workspace if the external location is isolated, otherwise the read will fail
// Bind the current workspace if the credential is isolated, otherwise the read will fail
return bindings.AddCurrentWorkspaceBindings(ctx, d, w, updateCredRequest.NameArg, catalog.UpdateBindingsSecurableTypeServiceCredential)
},
Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
Expand Down
4 changes: 3 additions & 1 deletion docs/resources/credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ resource "databricks_credential" "external" {
aws_iam_role {
role_arn = aws_iam_role.external_data_access.arn
}
purpose = "SERVICE"
comment = "Managed by TF"
}
Expand All @@ -43,6 +44,7 @@ resource "databricks_credential" "external_mi" {
azure_managed_identity {
access_connector_id = azurerm_databricks_access_connector.example.id
}
purpose = "SERVICE"
comment = "Managed identity credential managed by TF"
}
Expand All @@ -60,8 +62,8 @@ resource "databricks_grants" "external_creds" {
The following arguments are required:

- `name` - Name of Credentials, which must be unique within the [databricks_metastore](metastore.md). Change forces creation of a new resource.
- `purpose` - Indicates the purpose of the credential. Can be `SERVICE`.
- `owner` - (Optional) Username/groupname/sp application_id of the credential owner.
- `purpose` - (Optional) Indicates the purpose of the credential. Can be `SERVICE`.
- `read_only` - (Optional) Indicates whether the credential is only usable for read operations.
- `skip_validation` - (Optional) Suppress validation errors if any & force save the credential.
- `force_destroy` - (Optional) Delete credential regardless of its dependencies.
Expand Down

0 comments on commit bcfacea

Please sign in to comment.