databricks.Repo
Explore with Pulumi AI
This resource allows you to manage Databricks Git folders (formerly known as Databricks Repos).
Note To create a Git folder from a private repository you need to configure Git token as described in the documentation. To set this token you can use databricks.GitCredential resource.
Example Usage
You can declare Pulumi-managed Git folder by specifying url
attribute of Git repository. In addition to that you may need to specify git_provider
attribute if Git provider doesn’t belong to cloud Git providers (Github, GitLab, …). If path
attribute isn’t provided, then Git folder will be created in the default location:
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
const nutterInHome = new databricks.Repo("nutter_in_home", {url: "https://github.com/user/demo.git"});
import pulumi
import pulumi_databricks as databricks
nutter_in_home = databricks.Repo("nutter_in_home", url="https://github.com/user/demo.git")
package main
import (
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := databricks.NewRepo(ctx, "nutter_in_home", &databricks.RepoArgs{
Url: pulumi.String("https://github.com/user/demo.git"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() =>
{
var nutterInHome = new Databricks.Repo("nutter_in_home", new()
{
Url = "https://github.com/user/demo.git",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.Repo;
import com.pulumi.databricks.RepoArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var nutterInHome = new Repo("nutterInHome", RepoArgs.builder()
.url("https://github.com/user/demo.git")
.build());
}
}
resources:
nutterInHome:
type: databricks:Repo
name: nutter_in_home
properties:
url: https://github.com/user/demo.git
Access Control
- databricks.Permissions can control which groups or individual users can access repos.
Related Resources
The following resources are often used in the same context:
- End to end workspace management guide.
- databricks.GitCredential to manage Git credentials.
- databricks.Directory to manage directories in Databricks Workpace.
- databricks.Pipeline to deploy Delta Live Tables.
- databricks.Secret to manage secrets in Databricks workspace.
- databricks.SecretAcl to manage access to secrets in Databricks workspace.
- databricks.SecretScope to create secret scopes in Databricks workspace.
- databricks.WorkspaceConf to manage workspace configuration for expert usage.
Create Repo Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Repo(name: string, args: RepoArgs, opts?: CustomResourceOptions);
@overload
def Repo(resource_name: str,
args: RepoArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Repo(resource_name: str,
opts: Optional[ResourceOptions] = None,
url: Optional[str] = None,
branch: Optional[str] = None,
commit_hash: Optional[str] = None,
git_provider: Optional[str] = None,
path: Optional[str] = None,
sparse_checkout: Optional[RepoSparseCheckoutArgs] = None,
tag: Optional[str] = None)
func NewRepo(ctx *Context, name string, args RepoArgs, opts ...ResourceOption) (*Repo, error)
public Repo(string name, RepoArgs args, CustomResourceOptions? opts = null)
type: databricks:Repo
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RepoArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RepoArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RepoArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RepoArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RepoArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var repoResource = new Databricks.Repo("repoResource", new()
{
Url = "string",
Branch = "string",
CommitHash = "string",
GitProvider = "string",
Path = "string",
SparseCheckout = new Databricks.Inputs.RepoSparseCheckoutArgs
{
Patterns = new[]
{
"string",
},
},
Tag = "string",
});
example, err := databricks.NewRepo(ctx, "repoResource", &databricks.RepoArgs{
Url: pulumi.String("string"),
Branch: pulumi.String("string"),
CommitHash: pulumi.String("string"),
GitProvider: pulumi.String("string"),
Path: pulumi.String("string"),
SparseCheckout: &databricks.RepoSparseCheckoutArgs{
Patterns: pulumi.StringArray{
pulumi.String("string"),
},
},
Tag: pulumi.String("string"),
})
var repoResource = new Repo("repoResource", RepoArgs.builder()
.url("string")
.branch("string")
.commitHash("string")
.gitProvider("string")
.path("string")
.sparseCheckout(RepoSparseCheckoutArgs.builder()
.patterns("string")
.build())
.tag("string")
.build());
repo_resource = databricks.Repo("repoResource",
url="string",
branch="string",
commit_hash="string",
git_provider="string",
path="string",
sparse_checkout=databricks.RepoSparseCheckoutArgs(
patterns=["string"],
),
tag="string")
const repoResource = new databricks.Repo("repoResource", {
url: "string",
branch: "string",
commitHash: "string",
gitProvider: "string",
path: "string",
sparseCheckout: {
patterns: ["string"],
},
tag: "string",
});
type: databricks:Repo
properties:
branch: string
commitHash: string
gitProvider: string
path: string
sparseCheckout:
patterns:
- string
tag: string
url: string
Repo Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Repo resource accepts the following input properties:
- Url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- Branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - Commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- Git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - Path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- Sparse
Checkout RepoSparse Checkout - Tag string
- name of the tag for initial checkout. Conflicts with
branch
.
- Url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- Branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - Commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- Git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - Path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- Sparse
Checkout RepoSparse Checkout Args - Tag string
- name of the tag for initial checkout. Conflicts with
branch
.
- url String
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- branch String
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash String - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider String - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path String
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout RepoSparse Checkout - tag String
- name of the tag for initial checkout. Conflicts with
branch
.
- url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout RepoSparse Checkout - tag string
- name of the tag for initial checkout. Conflicts with
branch
.
- url str
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- branch str
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit_
hash str - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git_
provider str - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path str
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse_
checkout RepoSparse Checkout Args - tag str
- name of the tag for initial checkout. Conflicts with
branch
.
- url String
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- branch String
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash String - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider String - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path String
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout Property Map - tag String
- name of the tag for initial checkout. Conflicts with
branch
.
Outputs
All input properties are implicitly available as output properties. Additionally, the Repo resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- Id string
- The provider-assigned unique ID for this managed resource.
- Workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- id String
- The provider-assigned unique ID for this managed resource.
- workspace
Path String - path on Workspace File System (WSFS) in form of
/Workspace
+path
- id string
- The provider-assigned unique ID for this managed resource.
- workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- id str
- The provider-assigned unique ID for this managed resource.
- workspace_
path str - path on Workspace File System (WSFS) in form of
/Workspace
+path
- id String
- The provider-assigned unique ID for this managed resource.
- workspace
Path String - path on Workspace File System (WSFS) in form of
/Workspace
+path
Look up Existing Repo Resource
Get an existing Repo resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RepoState, opts?: CustomResourceOptions): Repo
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
branch: Optional[str] = None,
commit_hash: Optional[str] = None,
git_provider: Optional[str] = None,
path: Optional[str] = None,
sparse_checkout: Optional[RepoSparseCheckoutArgs] = None,
tag: Optional[str] = None,
url: Optional[str] = None,
workspace_path: Optional[str] = None) -> Repo
func GetRepo(ctx *Context, name string, id IDInput, state *RepoState, opts ...ResourceOption) (*Repo, error)
public static Repo Get(string name, Input<string> id, RepoState? state, CustomResourceOptions? opts = null)
public static Repo get(String name, Output<String> id, RepoState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - Commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- Git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - Path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- Sparse
Checkout RepoSparse Checkout - Tag string
- name of the tag for initial checkout. Conflicts with
branch
. - Url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- Workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- Branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - Commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- Git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - Path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- Sparse
Checkout RepoSparse Checkout Args - Tag string
- name of the tag for initial checkout. Conflicts with
branch
. - Url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- Workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- branch String
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash String - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider String - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path String
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout RepoSparse Checkout - tag String
- name of the tag for initial checkout. Conflicts with
branch
. - url String
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- workspace
Path String - path on Workspace File System (WSFS) in form of
/Workspace
+path
- branch string
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash string - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider string - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path string
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout RepoSparse Checkout - tag string
- name of the tag for initial checkout. Conflicts with
branch
. - url string
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- workspace
Path string - path on Workspace File System (WSFS) in form of
/Workspace
+path
- branch str
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit_
hash str - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git_
provider str - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path str
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse_
checkout RepoSparse Checkout Args - tag str
- name of the tag for initial checkout. Conflicts with
branch
. - url str
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- workspace_
path str - path on Workspace File System (WSFS) in form of
/Workspace
+path
- branch String
- name of the branch for initial checkout. If not specified, the default branch of the repository will be used. Conflicts with
tag
. Ifbranch
is removed, andtag
isn't specified, then the repository will stay at the previously checked out state. - commit
Hash String - Hash of the HEAD commit at time of the last executed operation. It won't change if you manually perform pull operation via UI or API
- git
Provider String - case insensitive name of the Git provider. Following values are supported right now (could be a subject for a change, consult Repos API documentation):
gitHub
,gitHubEnterprise
,bitbucketCloud
,bitbucketServer
,azureDevOpsServices
,gitLab
,gitLabEnterpriseEdition
,awsCodeCommit
. - path String
- path to put the checked out Git folder. If not specified, , then the Git folder will be created in the default location. If the value changes, Git folder is re-created.
- sparse
Checkout Property Map - tag String
- name of the tag for initial checkout. Conflicts with
branch
. - url String
- The URL of the Git Repository to clone from. If the value changes, Git folder is re-created.
- workspace
Path String - path on Workspace File System (WSFS) in form of
/Workspace
+path
Supporting Types
RepoSparseCheckout, RepoSparseCheckoutArgs
- Patterns List<string>
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
- Patterns []string
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
- patterns List<String>
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
- patterns string[]
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
- patterns Sequence[str]
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
- patterns List<String>
array of paths (directories) that will be used for sparse checkout. List of patterns could be updated in-place.
Addition or removal of the
sparse_checkout
configuration block will lead to recreation of the Git folder.
Import
The resource can be imported using the Git folder ID (obtained via UI or using API)
bash
$ pulumi import databricks:index/repo:Repo this repo_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
databricks
Terraform Provider.