diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b79220d74..c415b242b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## 0.5.7 -* Added `external_id` and `force` attributes to `databricks_service_principal` resource ([#1293](https://github.com/databrickslabs/terraform-provider-databricks/pull/1293)) +* Added `external_id` and `force` attributes to `databricks_service_principal` resource ([#1293](https://github.com/databrickslabs/terraform-provider-databricks/pull/1293)). +* Added documentation for `datarbicks_git_credential` resource ([#1295](https://github.com/databrickslabs/terraform-provider-databricks/pull/1295)). ## 0.5.6 diff --git a/docs/resources/git_credential.md b/docs/resources/git_credential.md new file mode 100644 index 0000000000..06fef555ba --- /dev/null +++ b/docs/resources/git_credential.md @@ -0,0 +1,50 @@ +--- +subcategory: "Workspace" +--- +# databricks_git_credential Resource + +This resource allows you to manage credentials for [Databricks Repos](https://docs.databricks.com/repos.html) using [Git Credentials API](https://docs.databricks.com/dev-tools/api/latest/gitcredentials.html). + + +## Example Usage + +You can declare Terraform-managed Git credential using following code: + +```hcl +resource "databricks_git_credential" "ado" { + git_username = "myuser" + git_provider = "azureDevOpsServices" + personal_access_token = "sometoken" +} +``` + +## Argument Reference + + +The following arguments are supported: + +* `personal_access_token` - (Required) The personal access token used to authenticate to the corresponding Git provider. +* `git_username` - (Required) user name at Git provider. +* `git_provider` - (Required) case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult [Git Credentials API documentation](https://docs.databricks.com/dev-tools/api/latest/gitcredentials.html)): `gitHub`, `gitHubEnterprise`, `bitbucketCloud`, `bitbucketServer`, `azureDevOpsServices`, `gitLab`, `gitLabEnterpriseEdition`, `awsCodeCommit`. +* `force` - (Optional) specify if settings need to be enforced - right now, Databricks allows only single Git credential, so if it's already configured, the apply operation will fail. + +## Attribute Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - identifier of specific Git credential + +## Import + +The resource cluster can be imported using ID of Git credential that could be obtained via REST API: + +```bash +$ terraform import databricks_git_credential.this +``` + + +## Related Resources + +The following resources are often used in the same context: + +* [databricks_repo](git_repo.md) to manage Databricks Repos. diff --git a/docs/resources/repo.md b/docs/resources/repo.md index d57e9b3fd8..e748a5f2d3 100644 --- a/docs/resources/repo.md +++ b/docs/resources/repo.md @@ -5,7 +5,7 @@ subcategory: "Workspace" This resource allows you to manage [Databricks Repos](https://docs.databricks.com/repos.html). --> **Note** To create a Repo from a private repository you need to configure Git token as described in the [documentation](https://docs.databricks.com/repos.html#configure-your-git-integration-with-databricks). **Right now this is possible only via Databricks UI due lack of corresponding REST API**. For the same reason, it also doesn't work for Service Principals. +-> **Note** To create a Repo from a private repository you need to configure Git token as described in the [documentation](https://docs.databricks.com/repos.html#configure-your-git-integration-with-databricks). To set this token you can use [databricks_git_credential](git_credential.md) resource. ## Example Usage @@ -24,11 +24,11 @@ resource "databricks_repo" "nutter_in_home" { The following arguments are supported: -* `url` - (Required) The URL of the Git Repository to clone from. If value changes, repo is re-created -* `git_provider` - (Optional, if it's possible to detect Git provider by host name) case insensitive name of the Git provider. Following values are supported right now (maybe a subject for change, consult [Repos API documentation](https://docs.databricks.com/dev-tools/api/latest/repos.html)): `gitHub`, `gitHubEnterprise`, `bitbucketCloud`, `bitbucketServer`, `azureDevOpsServices`, `gitLab`, `gitLabEnterpriseEdition` -* `path` - (Optional) path to put the checked out Repo. If not specified, then repo will be created in the user's repo directory (`/Repos//...`). If value changes, repo is re-created +* `url` - (Required) The URL of the Git Repository to clone from. If value changes, repo is re-created. +* `git_provider` - (Optional, if it's possible to detect Git provider by host name) case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult [Repos API documentation](https://docs.databricks.com/dev-tools/api/latest/repos.html)): `gitHub`, `gitHubEnterprise`, `bitbucketCloud`, `bitbucketServer`, `azureDevOpsServices`, `gitLab`, `gitLabEnterpriseEdition`, , `awsCodeCommit`. +* `path` - (Optional) path to put the checked out Repo. If not specified, then repo will be created in the user's repo directory (`/Repos//...`). If value changes, repo is re-created. * `branch` - (Optional) name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with `tag`. If `branch` is removed, and `tag` isn't specified, then the repository will stay at the previously checked out state. -* `tag` - (Optional) name of the tag for initial checkout. Conflicts with `branch` +* `tag` - (Optional) name of the tag for initial checkout. Conflicts with `branch`. ## Attribute Reference @@ -54,6 +54,7 @@ $ terraform import databricks_repo.this repo_id The following resources are often used in the same context: * [End to end workspace management](../guides/workspace-management.md) guide. +* [databricks_git_credential](git_credential.md) to manage Git credentials. * [databricks_directory](directory.md) to manage directories in [Databricks Workpace](https://docs.databricks.com/workspace/workspace-objects.html). * [databricks_pipeline](pipeline.md) to deploy [Delta Live Tables](https://docs.databricks.com/data-engineering/delta-live-tables/index.html). * [databricks_secret](secret.md) to manage [secrets](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.