diff --git a/catalog/resource_credential.go b/catalog/resource_credential.go index 07a44cc41..21076fee4 100644 --- a/catalog/resource_credential.go +++ b/catalog/resource_credential.go @@ -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 @@ -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 { diff --git a/docs/resources/credential.md b/docs/resources/credential.md index eaa5bb9e0..1374a747f 100644 --- a/docs/resources/credential.md +++ b/docs/resources/credential.md @@ -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" } @@ -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" } @@ -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.