Bitbucket Provider
Generate Provider
The Bitbucket provider must be installed as a Local Package by following the instructions for Any Terraform Provider:
pulumi package add terraform-provider drfaust92/bitbucket
Overview
The Bitbucket provider allows you to manage resources including repositories, webhooks, and default reviewers.
Use the navigation to the left to read about the available resources.
Example Usage
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
import * as pulumi from "@pulumi/pulumi";
import * as bitbucket from "@pulumi/bitbucket";
const illusions = new bitbucket.Repository("illusions", {
owner: "theleagueofmagicians",
name: "illusions",
scm: "hg",
isPrivate: true,
});
const project = new bitbucket.Project("project", {
owner: "theleagueofmagicians",
name: "illusions-project",
key: "ILLUSIONSPROJ",
isPrivate: true,
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
import pulumi
import pulumi_bitbucket as bitbucket
illusions = bitbucket.Repository("illusions",
owner="theleagueofmagicians",
name="illusions",
scm="hg",
is_private=True)
project = bitbucket.Project("project",
owner="theleagueofmagicians",
name="illusions-project",
key="ILLUSIONSPROJ",
is_private=True)
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Bitbucket = Pulumi.Bitbucket;
return await Deployment.RunAsync(() =>
{
var illusions = new Bitbucket.Repository("illusions", new()
{
Owner = "theleagueofmagicians",
Name = "illusions",
Scm = "hg",
IsPrivate = true,
});
var project = new Bitbucket.Project("project", new()
{
Owner = "theleagueofmagicians",
Name = "illusions-project",
Key = "ILLUSIONSPROJ",
IsPrivate = true,
});
});
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
package main
import (
"github.com/pulumi/pulumi-pulumi-provider/sdks/go/bitbucket/v2/bitbucket"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := bitbucket.NewRepository(ctx, "illusions", &bitbucket.RepositoryArgs{
Owner: pulumi.String("theleagueofmagicians"),
Name: pulumi.String("illusions"),
Scm: pulumi.String("hg"),
IsPrivate: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = bitbucket.NewProject(ctx, "project", &bitbucket.ProjectArgs{
Owner: pulumi.String("theleagueofmagicians"),
Name: pulumi.String("illusions-project"),
Key: pulumi.String("ILLUSIONSPROJ"),
IsPrivate: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
resources:
illusions:
type: bitbucket:Repository
properties:
owner: theleagueofmagicians
name: illusions
scm: hg
isPrivate: true
project:
type: bitbucket:Project
properties:
owner: theleagueofmagicians
name: illusions-project
key: ILLUSIONSPROJ
isPrivate: true
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
bitbucket:password:
value: idoillusions
bitbucket:username:
value: GobBluthe
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.bitbucket.Repository;
import com.pulumi.bitbucket.RepositoryArgs;
import com.pulumi.bitbucket.Project;
import com.pulumi.bitbucket.ProjectArgs;
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 illusions = new Repository("illusions", RepositoryArgs.builder()
.owner("theleagueofmagicians")
.name("illusions")
.scm("hg")
.isPrivate(true)
.build());
var project = new Project("project", ProjectArgs.builder()
.owner("theleagueofmagicians")
.name("illusions-project")
.key("ILLUSIONSPROJ")
.isPrivate(true)
.build());
}
}
Configuration Reference
The following configuration inputs are supported in the provider configuration:
username
- (Optional) Username to use for authentication via Basic Auth. You can also set this via theBITBUCKET_USERNAME
environment variable. If configured, requirespassword
to be configured as well.password
- (Optional) Password to use for authentication via Basic Auth. Please note that this has to be an App Password that has to be created in the Account Settings. You can also set this via theBITBUCKET_PASSWORD
environment variable. If configured, requiresusername
to be configured as well.oauthClientId
- (Optional) OAuth client ID to use for authentication via Client Credentials Grant. You can also set this via theBITBUCKET_OAUTH_CLIENT_ID
environment variable. If configured, requiresoauthClientSecret
to be configured as well.oauthClientSecret
- (Optional) OAuth client secret to use for authentication via Client Credentials Grant. You can also set this via theBITBUCKET_OAUTH_CLIENT_SECRET
environment variable. If configured, requiresoauthClientId
to be configured as well.oauthToken
- (Optional) An OAuth access token used for authentication via OAuth. You can also set this via theBITBUCKET_OAUTH_TOKEN
environment variable.
OAuth2 Scopes
To interacte with the Bitbucket API, an App Password or OAuth Client Credentials are required.
App passwords and OAuth client credentials are limited in scope, each API requires certain scope to interact with, each resource doc will specify what are the scopes required to use that resource.
See the Bitbucket OAuth Documentation for more information on scopes.