Skip to content

Commit efe1c74

Browse files
authored
Added doc for Git Credentials (#1295)
Also updated `databricks_repo` doc.
1 parent ef3e094 commit efe1c74

File tree

3 files changed

+58
-6
lines changed

3 files changed

+58
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## 0.5.7
44

5-
* Added `external_id` and `force` attributes to `databricks_service_principal` resource ([#1293](https://github.com/databrickslabs/terraform-provider-databricks/pull/1293))
5+
* Added `external_id` and `force` attributes to `databricks_service_principal` resource ([#1293](https://github.com/databrickslabs/terraform-provider-databricks/pull/1293)).
6+
* Added documentation for `datarbicks_git_credential` resource ([#1295](https://github.com/databrickslabs/terraform-provider-databricks/pull/1295)).
67

78
## 0.5.6
89

docs/resources/git_credential.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
subcategory: "Workspace"
3+
---
4+
# databricks_git_credential Resource
5+
6+
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).
7+
8+
9+
## Example Usage
10+
11+
You can declare Terraform-managed Git credential using following code:
12+
13+
```hcl
14+
resource "databricks_git_credential" "ado" {
15+
git_username = "myuser"
16+
git_provider = "azureDevOpsServices"
17+
personal_access_token = "sometoken"
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
24+
The following arguments are supported:
25+
26+
* `personal_access_token` - (Required) The personal access token used to authenticate to the corresponding Git provider.
27+
* `git_username` - (Required) user name at Git provider.
28+
* `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`.
29+
* `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.
30+
31+
## Attribute Reference
32+
33+
In addition to all arguments above, the following attributes are exported:
34+
35+
* `id` - identifier of specific Git credential
36+
37+
## Import
38+
39+
The resource cluster can be imported using ID of Git credential that could be obtained via REST API:
40+
41+
```bash
42+
$ terraform import databricks_git_credential.this <git-credential-id>
43+
```
44+
45+
46+
## Related Resources
47+
48+
The following resources are often used in the same context:
49+
50+
* [databricks_repo](git_repo.md) to manage Databricks Repos.

docs/resources/repo.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ subcategory: "Workspace"
55

66
This resource allows you to manage [Databricks Repos](https://docs.databricks.com/repos.html).
77

8-
-> **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.
8+
-> **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.
99

1010
## Example Usage
1111

@@ -24,11 +24,11 @@ resource "databricks_repo" "nutter_in_home" {
2424

2525
The following arguments are supported:
2626

27-
* `url` - (Required) The URL of the Git Repository to clone from. If value changes, repo is re-created
28-
* `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`
29-
* `path` - (Optional) path to put the checked out Repo. If not specified, then repo will be created in the user's repo directory (`/Repos/<username>/...`). If value changes, repo is re-created
27+
* `url` - (Required) The URL of the Git Repository to clone from. If value changes, repo is re-created.
28+
* `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`.
29+
* `path` - (Optional) path to put the checked out Repo. If not specified, then repo will be created in the user's repo directory (`/Repos/<username>/...`). If value changes, repo is re-created.
3030
* `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.
31-
* `tag` - (Optional) name of the tag for initial checkout. Conflicts with `branch`
31+
* `tag` - (Optional) name of the tag for initial checkout. Conflicts with `branch`.
3232

3333
## Attribute Reference
3434

@@ -54,6 +54,7 @@ $ terraform import databricks_repo.this repo_id
5454
The following resources are often used in the same context:
5555

5656
* [End to end workspace management](../guides/workspace-management.md) guide.
57+
* [databricks_git_credential](git_credential.md) to manage Git credentials.
5758
* [databricks_directory](directory.md) to manage directories in [Databricks Workpace](https://docs.databricks.com/workspace/workspace-objects.html).
5859
* [databricks_pipeline](pipeline.md) to deploy [Delta Live Tables](https://docs.databricks.com/data-engineering/delta-live-tables/index.html).
5960
* [databricks_secret](secret.md) to manage [secrets](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.

0 commit comments

Comments
 (0)