Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added doc for Git Credentials #1295

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 50 additions & 0 deletions docs/resources/git_credential.md
Original file line number Diff line number Diff line change
@@ -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 <git-credential-id>
```


## Related Resources

The following resources are often used in the same context:

* [databricks_repo](git_repo.md) to manage Databricks Repos.
11 changes: 6 additions & 5 deletions docs/resources/repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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/<username>/...`). 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/<username>/...`). 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

Expand All @@ -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.
Expand Down