Port to GitHub actions & publish to Terraform registry (#39)

* Port to GitHub actions

* Fix

* Make docs terraform registry compatible
This commit is contained in:
Gavin Bunney
2021-07-14 17:47:45 -07:00
committed by GitHub
parent 4adaea3109
commit 0b0d03cda2
55 changed files with 265 additions and 7652 deletions

View File

@@ -0,0 +1,16 @@
# Data Source: bitbucketserver_application_properties
This data source allows you to retrieve version information and other application properties of Bitbucket Server.
## Example Usage
```hcl
data "bitbucketserver_application_properties" "main" { }
```
## Attribute Reference
* `version` - Version of Bitbucket.
* `build_number` - Build number of the Bitbucket instance.
* `build_date` - Date the Bitbucket build was made,
* `display_name` - Name of the Bitbucket instance.

View File

@@ -0,0 +1,29 @@
# Data Source: bitbucketserver_cluster
Gets information about the nodes that currently make up the Bitbucket cluster.
## Example Usage
```hcl
data "bitbucketserver_cluster" "main" { }
output "local_hostname" {
value = "Bitbucket running on ${data.bitbucketserver_cluster.main.local_node.0.hostname}"
}
```
## Attribute Reference
* `local_node` - List with a single element, containing the local node details. See `node` schema below.
* `nodes` - List of nodes of the Bitbucket cluster.
* `running` - Flag is the cluster is running.
### Node Schema
Each node in the attributes above contains the following elements:
* `id` - Unique cluster identifier.
* `name` - Unique cluster identifier.
* `hostname` - Address hostname of the cluster node. Typically an IP address.
* `port` - Port of the cluster node. This is not the same as the Bitbucket UI port, rather the node cluster port.
* `local` - Flag if this is a local node.

View File

@@ -0,0 +1,33 @@
# Data Source: bitbucketserver_global_permissions_groups
Retrieve a list of groups that have been granted at least one global permission.
## Example Usage
```hcl
data "bitbucketserver_global_permissions_groups" "all" { }
```
### Applying a Custom Filter
Find any groups starting with `dev`.
```hcl
data "bitbucketserver_global_permissions_groups" "dev-groups" {
filter = "dev"
}
```
## Argument Reference
* `filter` - Optional. If specified only group names containing the supplied string will be returned.
## Attribute Reference
* `groups` - List of maps containing `name` and `permission` keys. Available permissions are:
* `LICENSED_USER`
* `PROJECT_CREATE`
* `ADMIN`
* `SYS_ADMIN`

View File

@@ -0,0 +1,36 @@
---
id: data_bitbucketserver_global_permissions_users
title: bitbucketserver_global_permissions_users
---
Retrieve a list of users that have been granted at least one global permission.
## Example Usage
```hcl
data "bitbucketserver_global_permissions_users" "all" { }
```
### Applying a Custom Filter
Find any users starting with `malcolm`.
```hcl
data "bitbucketserver_global_permissions_users" "malcolms" {
filter = "malcolm"
}
```
## Argument Reference
* `filter` - Optional. If specified only user's names/emails containing the supplied string will be returned.
## Attribute Reference
* `users` - List of maps containing `name`, `email_address`, `display_name`, `active` and `permission` keys. Available permissions are: `LICENSED_USER`, `PROJECT_CREATE`, `ADMIN`, `SYS_ADMIN`
* `LICENSED_USER`
* `PROJECT_CREATE`
* `ADMIN`
* `SYS_ADMIN`

View File

@@ -0,0 +1,31 @@
# Data Source: bitbucketserver_group_users
Retrieve a list of users for a specific group.
## Example Usage
```hcl
data "bitbucketserver_group_users" "stash-users" {
group = "stash-users"
}
```
### Applying a Custom Filter
Find any users starting with `malcolm`.
```hcl
data "bitbucketserver_group_users" "malcolms" {
group = "stash-users"
filter = "malcolm"
}
```
## Argument Reference
* `group` - Required. Group to find the users for.
* `filter` - Optional. If specified only users matching name/email for the supplied string will be returned.
## Attribute Reference
* `users` - List of maps containing `name`, `email_address`, `display_name` and `active` keys.

View File

@@ -0,0 +1,27 @@
# Data Source: bitbucketserver_groups
This data source allows you to retrieve a list of groups, optionally matching the supplied `filter`.
## Example Usage
```hcl
data "bitbucketserver_groups" "all" { }
```
### Applying a Custom Filter
Find any groups starting with `dev`.
```hcl
data "bitbucketserver_groups" "dev-groups" {
filter = "dev"
}
```
## Argument Reference
* `filter` - Optional. If specified only group names containing the supplied string will be returned.
## Attribute Reference
* `groups` - List of maps containing `name` key.

View File

@@ -0,0 +1,46 @@
# Data Source: bitbucketserver_plugin
This data source allows you to retrieve installed plugin information and license details.
## Example Usage
```hcl
data "bitbucketserver_plugin" "my-plugin" {
key = "com.example.plugin-my-plugin"
}
```
## Argument Reference
* `key` - Unique key of the plugin.
## Attribute Reference
* `enabled` - Set to `true` if the plugin is enabled.
* `enabled_by_default` - Set to `true` if the plugin is enabled by default (for system plugins).
* `version` - Installed version of the plugin.
* `name` - Name of the plugin.
* `description` - Plugin description.
* `user_installed` - Set to `true` if this is a user installed plugin vs a system bundled plugin.
* `optional` - Set to `true` if this is an optional plugin.
* `vendor.name` - Name of the vendor.
* `vendor.link` - Vendor homepage.
* `vendor.marketplace_link` - Plugin marketplace link.
* `applied_license.0.valid` - Is the license valid. true/false.
* `applied_license.0.evaluation` - Is the license an evaluation. true/false.
* `applied_license.0.nearly_expired` - Is the license nearly expired. true/false.
* `applied_license.0.maintenance_expiry_date` - Date of maintenance expiry.
* `applied_license.0.maintenance_expired` - Is the maintenance expired. true/false.
* `applied_license.0.license_type` - Type of license.
* `applied_license.0.expiry_date` - Expiry date of the license.
* `applied_license.0.raw_license` - The raw license information.
* `applied_license.0.renewable` - Is the license renewabl. true/false.
* `applied_license.0.organization_name` - Name of the organization the license is for.
* `applied_license.0.enterprise` - Is the license for enterprise. true/false.
* `applied_license.0.data_center` - Is the license for data center. true/false.
* `applied_license.0.subscription` - Is the license a subscription. true/false.
* `applied_license.0.active` - Is the license active. true/false.
* `applied_license.0.auto_renewal` - Is the license renewed automatically. true/false.
* `applied_license.0.upgradable` - Is the license able to be upgraded. true/false.
* `applied_license.0.crossgradeable` - Can the license be crossgraded. true/false.
* `applied_license.0.purchase_past_server_cutoff_date` - The purchase date past the server cutoff date. true/false.

View File

@@ -0,0 +1,54 @@
# Data Source: bitbucketserver_project_hooks
Retrieve a list of project hooks and their status' for the specified project.
## Example Usage
```hcl
data "bitbucketserver_project_hooks" "main" {
project = "TEST"
}
# data.bitbucketserver_project_hooks.main.hooks = [{
# "key" = "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook",
# "name" = "Reject Force Push",
# "type" = "PRE_RECEIVE",
# "description" = "Reject all force pushes (git push --force) to this repository",
# "version" = "6.7.0",
# "scope_types" = ["PROJECT", "REPOSITORY"],
# "enabled" = "false",
# "configured" = "false",
# "scope_type" = "PROJECT",
# }]
```
### Applying a Custom Filter
Find specific types of project hooks.
```hcl
data "bitbucketserver_project_hooks" "main" {
project = "TEST"
type = "PRE_RECEIVE"
}
```
## Argument Reference
* `project` - Required. Project Key to lookup hooks for.
* `type` - Optional. Type of hook to find. Must be one of `PRE_RECEIVE`, `POST_RECEIVE`
## Attribute Reference
* `hooks` - List of maps containing:
* `key` - Unique key identifying the hook e.g. `com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook`
* `name` - Name of the hook e.g. `Reject Force Push`
* `type` - Type of the hook e.g. `PRE_RECEIVE`
* `description` - Detailed description e.g. `Reject all force pushes (git push --force) to this repository`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `6.7.0`
* `scope_types` - List of strings containing the scopes available for this hook, e.g. `["PROJECT", "REPOSITORY"]`
* `enabled` - Set if this hook is enabled for this project
* `configured` - Set if the hook is configured for this project
* `scope_type` - Type of scope applied for this hook, e.g. `PROJECT`
* `scope_resource_id` - Reference ID of the applied scope, e.g. `1`

View File

@@ -0,0 +1,35 @@
# Data Source: bitbucketserver_project_permissions_groups
Retrieve a list of groups that have been granted at least one project level permission to the specified project.
## Example Usage
```hcl
data "bitbucketserver_project_permissions_groups" "test-groups" {
project = "TEST"
}
```
### Applying a Custom Filter
Find project groups starting with `dev` with project permissions.
```hcl
data "bitbucketserver_project_permissions_groups" "dev-groups" {
project = "TEST"
filter = "dev"
}
```
## Argument Reference
* `project` - Required. Project Key to lookup permissions for.
* `filter` - Optional. If specified only group names containing the supplied string will be returned.
## Attribute Reference
* `groups` - List of maps containing `name` and `permission` keys. Available permissions are:
* `PROJECT_READ`
* `PROJECT_WRITE`
* `PROJECT_ADMIN`

View File

@@ -0,0 +1,35 @@
# Data Source: bitbucketserver_project_permissions_users
Retrieve a list of users that have been granted at least one permission for the specified project.
## Example Usage
```hcl
data "bitbucketserver_project_permissions_users" "test-users" {
project = "TEST"
}
```
### Applying a Custom Filter
Find project users starting with `malcolm`.
```hcl
data "bitbucketserver_project_permissions_users" "malcolms" {
project = "TEST"
filter = "malcolm"
}
```
## Argument Reference
* `project` - Required. Project Key to lookup permissions for.
* `filter` - Optional. If specified only user's names/emails containing the supplied string will be returned.
## Attribute Reference
* `users` - List of maps containing `name`, `email_address`, `display_name`, `active` and `permission` keys. Available permissions are:
* `PROJECT_READ`
* `PROJECT_WRITE`
* `PROJECT_ADMIN`

View File

@@ -0,0 +1,57 @@
# Data Source: bitbucketserver_repository_hooks
Retrieve a list of repository hooks and their status' for the specified repo.
## Example Usage
```hcl
data "bitbucketserver_repository_hooks" "main" {
project = "TEST"
repository = "repo1"
}
# data.bitbucketserver_repository_hooks.main.hooks = [{
# "key" = "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook",
# "name" = "Reject Force Push",
# "type" = "PRE_RECEIVE",
# "description" = "Reject all force pushes (git push --force) to this repository",
# "version" = "6.7.0",
# "scope_types" = ["PROJECT", "REPOSITORY"],
# "enabled" = "false",
# "configured" = "false",
# "scope_type" = "REPOSITORY",
# }]
```
### Applying a Custom Filter
Find specific types of repository hooks.
```hcl
data "bitbucketserver_project_hooks" "main" {
project = "TEST"
repository = "repo1"
type = "PRE_RECEIVE"
}
```
## Argument Reference
* `project` - Required. Project Key the repository is contained within.
* `repository` - Required. Repository slug to lookup hooks for.
* `type` - Optional. Type of hook to find. Must be one of `PRE_RECEIVE`, `POST_RECEIVE`
## Attribute Reference
* `hooks` - List of maps containing:
* `key` - Unique key identifying the hook e.g. `com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook`
* `name` - Name of the hook e.g. `Reject Force Push`
* `type` - Type of the hook e.g. `PRE_RECEIVE`
* `description` - Detailed description e.g. `Reject all force pushes (git push --force) to this repository`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `6.7.0`
* `scope_types` - List of strings containing the scopes available for this hook, e.g. `["PROJECT", "REPOSITORY"]`
* `enabled` - Set if this hook is enabled for this project
* `configured` - Set if the hook is configured for this project
* `scope_type` - Type of scope applied for this hook, e.g. `REPOSITORY`
* `scope_resource_id` - Reference ID of the applied scope, e.g. `1`

View File

@@ -0,0 +1,38 @@
# Data Source: bitbucketserver_repository_permissions_groups
Retrieve a list of groups that have been granted at least one repository level permission to the specified repo.
## Example Usage
```hcl
data "bitbucketserver_repository_permissions_groups" "my-repo-groups" {
project = "TEST"
repository = "my-repo"
}
```
### Applying a Custom Filter
Find project groups starting with `dev` with project permissions.
```hcl
data "bitbucketserver_repository_permissions_groups" "my-repo-dev-groups" {
project = "TEST"
repository = "my-repo"
filter = "dev"
}
```
## Argument Reference
* `project` - Required. Project Key to lookup permissions for.
* `repository` - Required. Repository slug to lookup permissions for.
* `filter` - Optional. If specified only group names containing the supplied string will be returned.
## Attribute Reference
* `groups` - List of maps containing `name` and `permission` keys. Available permissions are:
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`

View File

@@ -0,0 +1,38 @@
# Data Source: bitbucketserver_repository_permissions_users
Retrieve a list of users that have been granted at least one permission for the specified repository.
## Example Usage
```hcl
data "bitbucketserver_repository_permissions_users" "my-repo-users" {
project = "TEST"
repository = "my-repo"
}
```
### Applying a Custom Filter
Find repository users starting with `malcolm`.
```hcl
data "bitbucketserver_repository_permissions_users" "my-repo-malcolms" {
project = "TEST"
repository = "my-repo"
filter = "malcolm"
}
```
## Argument Reference
* `project` - Required. Project Key to lookup permissions for.
* `repository` - Required. Repository slug to lookup permissions for.
* `filter` - Optional. If specified only user's names/emails containing the supplied string will be returned.
## Attribute Reference
* `users` - List of maps containing `name`, `email_address`, `display_name`, `active` and `permission` keys. Available permissions are:
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`

View File

@@ -0,0 +1,21 @@
# Data Source: bitbucketserver_user
This data source allows you to retrieve Bitbucket user details.
## Example Usage
```hcl
data "bitbucketserver_user" "admin" {
name = "admin"
}
```
## Argument Reference
* `name` - Unique name of the user.
## Attribute Reference
* `email_address` - User's email.
* `display_name` - User's display name.
* `user_id` - User's ID.

100
docs/index.md Executable file
View File

@@ -0,0 +1,100 @@
# Bitbucket Server Provider
[Bitbucket Server](https://www.atlassian.com/software/bitbucket) is the self-hosted version of Bitbucket.
Whilst terraform provides a default bitbucket provider, this only works for _Bitbucket Cloud_ - this provider
unlocks the power of terraform to manage your self-hosted Bitbucket Server instance.
## Installation
### Terraform 0.13+
The provider can be installed and managed automatically by Terraform. Sample `versions.tf` file :
```hcl
terraform {
required_version = ">= 0.13"
required_providers {
bitbucketserver = {
source = "gavinbunney/bitbucketserver"
}
}
}
```
### Terraform 0.12
#### Install latest version
The following one-liner script will fetch the latest provider version and download it to your `~/.terraform.d/plugins` directory.
```bash
$ mkdir -p ~/.terraform.d/plugins && \
curl -Ls https://api.github.com/repos/gavinbunney/terraform-provider-bitbucketserver/releases/latest \
| jq -r ".assets[] | select(.browser_download_url | contains(\"$(uname -s | tr A-Z a-z)\")) | select(.browser_download_url | contains(\"amd64\")) | .browser_download_url" \
| xargs -n 1 curl -Lo ~/.terraform.d/plugins/terraform-provider-bitbucketserver.zip && \
pushd ~/.terraform.d/plugins/ && \
unzip ~/.terraform.d/plugins/terraform-provider-bitbucketserver.zip -d terraform-provider-bitbucketserver-tmp && \
mv terraform-provider-bitbucketserver-tmp/terraform-provider-bitbucketserver* . && \
chmod +x terraform-provider-bitbucketserver* && \
rm -rf terraform-provider-bitbucketserver-tmp && \
rm -rf terraform-provider-bitbucketserver.zip && \
popd
```
#### Install manually
If you don't want to use the one-liner above, you can download a binary for your system from the [release page](https://github.com/gavinbunney/terraform-provider-bitbucketserver/releases),
then either place it at the root of your Terraform folder or in the Terraform plugin folder on your system.
## Configuration
The provider supports parameters to determine the bitbucket server and admin user/password to use.
```hcl
provider "bitbucketserver" {
server = "https://mybitbucket.example.com"
username = "admin"
password = "password"
}
```
### Authentication
The `username` and `password` specified should be of a user with sufficient privileges to perform the operations you are after.
Typically this is a user with `SYS_ADMIN` global permissions.
### Environment Variables
You can also specify the provider configuration using the following env vars:
* `BITBUCKET_SERVER`
* `BITBUCKER_USERNAME`
* `BITBUCKET_PASSWORD`
> Note: The hcl provider configuration takes precedence over the environment variables.
## Example - Creating a Project and Repository
Creating a project and repository is super simple with this provider:
```hcl
provider "bitbucketserver" {
server = "https://mybitbucket.example.com"
username = "admin"
password = "password"
}
resource "bitbucketserver_project" "test" {
key = "TEST"
name = "test-01"
description = "Test project"
}
resource "bitbucketserver_repository" "test" {
project = bitbucketserver_project.test.key
name = "repo-01"
description = "Test repository"
}
```

View File

@@ -0,0 +1,25 @@
# Resource: bitbucketserver_banner
Manage the announcement banner, updating as required.
## Example Usage
```hcl
resource "bitbucketserver_banner" "main" {
message = "Bitbucket is down for maintenance\n*Save your work*"
}
```
## Argument Reference
* `message` - Required. Information to display to the user. Markdown supported.
* `enabled` - Optional. Turn the announcement banner on/off. Default `true`.
* `audience` - Optional. Set the audience for the announcement. Must be one of `ALL` or `AUTHENTICATED`. Default `ALL`.
## Import
Import the banner:
```
terraform import bitbucketserver_banner.main banner
```

View File

@@ -0,0 +1,49 @@
# Resource: bitbucketserver_default_reviewers_condition
Create a default reviewers condition for project or repository.
## Example Usage
```hcl
resource "bitbucketserver_default_reviewers_condition" "condition" {
project_key = "PRO"
repository_slug = "repository-1"
source_matcher = {
id = "any"
type_id = "ANY_REF"
}
target_matcher = {
id = "any"
type_id = "ANY_REF"
}
reviewers = [1]
required_approvals = 1
}
```
## Argument Reference
* `project_key` - Required. Project key.
* `repository_slug` - Optional. Repository slug. If empty, default reviewers condition will be created for the whole project.
* `source_matcher.id` - Required. Source branch matcher id. It can be either `"any"` to match all branches, `"refs/heads/master"` to match certain branch, `"pattern"` to match multiple branches or `"development"` to match branching model.
* `source_matcher.type_id` - Required. Source branch matcher type.It must be one of: `"ANY_REF"`, `"BRANCH"`, `"PATTERN"`, `"MODEL_BRANCH"`.
* `target_matcher.id` - Required. Target branch matcher id. It can be either `"any"` to match all branches, `"refs/heads/master"` to match certain branch, `"pattern"` to match multiple branches or `"development"` to match branching model.
* `target_matcher.type_id` - Required. Target branch matcher type. It must be one of: `"ANY_REF"`, `"BRANCH"`, `"PATTERN"`, `"MODEL_BRANCH"`.
* `reviewers` - Required. IDs of Bitbucket users to become default reviewers when new pull request is created.
* `required_approvals` - Required. The number of default reviewers that must approve a pull request. Can't be higher than length of `reviewers`.
You can find more information about [how to use branch matchers here](https://confluence.atlassian.com/bitbucketserver/add-default-reviewers-to-pull-requests-834221295.html).
## Import
Import a default reviewers condition reference via the ID in this format `condition_id:project_key:repository_slug`.
```
terraform import bitbucketserver_default_reviewers_condition.test 1:pro:repo
```
When importing a default reviewers condition for the whole project omit the `repository_slug`.
```
terraform import bitbucketserver_default_reviewers_condition.test 1:pro
```

View File

@@ -0,0 +1,25 @@
# Resource: bitbucketserver_global_permissions_group
Set global permissions for a given group.
## Example Usage
```hcl
resource "bitbucketserver_global_permissions_group" "test" {
group = "stash-users"
permission = "ADMIN"
}
```
## Argument Reference
* `group` - Required. Name of the group permissions are for.
* `permission` - Required. The permission to grant. Available global permissions are: `LICENSED_USER`, `PROJECT_CREATE`, `ADMIN`, `SYS_ADMIN`
## Import
Import a group global permissions via the group name:
```
terraform import bitbucketserver_global_permissions_group.test my-group
```

View File

@@ -0,0 +1,25 @@
# Resource: bitbucketserver_global_permissions_user
Set global permissions for a given user.
## Example Usage
```hcl
resource "bitbucketserver_global_permissions_user" "mreynolds" {
user = "mreynolds"
permission = "ADMIN"
}
```
## Argument Reference
* `user` - Required. Name of the user permissions are for.
* `permission` - Required. The permission to grant. Available global permissions are: `LICENSED_USER`, `PROJECT_CREATE`, `ADMIN`, `SYS_ADMIN`
## Import
Import a user global permissions via the user's name:
```
terraform import bitbucketserver_global_permissions_user.test mreynolds
```

View File

@@ -0,0 +1,24 @@
# Resource: bitbucketserver_group
Create a Bitbucket group.
## Example Usage
```hcl
resource "bitbucketserver_group" "browncoats" {
name = "browncoats"
}
```
## Argument Reference
* `name` - Required. Group to create.
* `import_if_exists` - Optional. Import groups that already exist in bitbucket into the terraform state file.
## Import
Import a group reference via the name.
```
terraform import bitbucketserver_group.test browncoats
```

View File

@@ -0,0 +1,35 @@
# Resource: bitbucketserver_license
Set the license for the bitbucket server.
## Example Usage
```hcl
resource "bitbucketserver_license" "main" {
license = "AAACLg0ODAoPeNqNVEtv4jAQvudXRNpbp"
}
```
## Argument Reference
* `license` - Required. License to apply.
## Attribute Reference
* `creation_date` - License creation date.
* `purchase_date` - License purchase date.
* `expiry_date` - Expiry date of the license.
* `maintenance_expiry_date` - Expiry date of the maintenance period.
* `grace_period_end_date` - Grace period beyond expiry date.
* `maximum_users` - Maximum number of users for license.
* `unlimited_users` - Boolean flag if this is an unlimited user license.
* `server_id` - Server ID.
* `support_entitlement_number` - Entitlement number for support requests.
## Import
Import the license details:
```
terraform import bitbucketserver_license.main license
```

View File

@@ -0,0 +1,33 @@
# Resource: bitbucketserver_mail_server
Setup mail server configuration.
## Example Usage
```hcl
resource "bitbucketserver_mail_server" "mail" {
hostname = "mail.example.com"
port = 465
protocol = "SMTPS"
sender_address = "bitbucket@example.com"
}
```
## Argument Reference
* `hostname` - Required. Hostname of the mail server.
* `port` - Required. Port number of the mail server. Typically port 25 or 587 for SMTP and 465 for SMTPS.
* `sender_address` - Required. Email address for notification emails.
* `protocol` - Optional. SMTP or SMTPS supported. Default `SMTP`
* `use_start_tls` - Optional. Use SSL/TLS if available. Default `true`
* `require_start_tls` - Optional. Require SSL to be used. Default `false`
* `username` - Optional. User to connect with.
* `password` - Optional. User to connect with.
## Import
Import the existing mail server configuration with the hostname:
```
terraform import bitbucketserver_mail_server.mail mail.example.com
```

View File

@@ -0,0 +1,57 @@
# Resource: bitbucketserver_plugin
Install plugins, manage enabled state and set license details.
## Example Usage
```hcl
resource "bitbucketserver_plugin" "myplugin" {
key = "com.example-my-plugin"
version = "1.2.3"
license = "ABCDEF"
}
```
## Argument Reference
* `key` - Required. Unique key of the plugin.
* `version` - Required. Version to install.
* `license` - Optional. License to apply to the plugin.
* `enabled` - Optional, default `true`. Flag to enable/disable the plugin.
## Attribute Reference
* `enabled_by_default` - Set to `true` if the plugin is enabled by default (for system plugins).
* `name` - Name of the plugin.
* `description` - Plugin description.
* `user_installed` - Set to `true` if this is a user installed plugin vs a system bundled plugin.
* `optional` - Set to `true` if this is an optional plugin.
* `vendor.name` - Name of the vendor.
* `vendor.link` - Vendor homepage.
* `vendor.marketplace_link` - Plugin marketplace link.
* `applied_license.0.valid` - Is the license valid. true/false.
* `applied_license.0.evaluation` - Is the license an evaluation. true/false.
* `applied_license.0.nearly_expired` - Is the license nearly expired. true/false.
* `applied_license.0.maintenance_expiry_date` - Date of maintenance expiry.
* `applied_license.0.maintenance_expired` - Is the maintenance expired. true/false.
* `applied_license.0.license_type` - Type of license.
* `applied_license.0.expiry_date` - Expiry date of the license.
* `applied_license.0.raw_license` - The raw license information.
* `applied_license.0.renewable` - Is the license renewabl. true/false.
* `applied_license.0.organization_name` - Name of the organization the license is for.
* `applied_license.0.enterprise` - Is the license for enterprise. true/false.
* `applied_license.0.data_center` - Is the license for data center. true/false.
* `applied_license.0.subscription` - Is the license a subscription. true/false.
* `applied_license.0.active` - Is the license active. true/false.
* `applied_license.0.auto_renewal` - Is the license renewed automatically. true/false.
* `applied_license.0.upgradable` - Is the license able to be upgraded. true/false.
* `applied_license.0.crossgradeable` - Can the license be crossgraded. true/false.
* `applied_license.0.purchase_past_server_cutoff_date` - The purchase date past the server cutoff date. true/false.
## Import
Import a plugin reference via the key:
```
terraform import bitbucketserver_plugin.myplugin com.example-my-plugin
```

View File

@@ -0,0 +1,25 @@
# Resource: bitbucketserver_plugin_config
Configure plugins.
## Example Usage
```hcl
resource "bitbucketserver_plugin_config" "mypluginconfig" {
config_endpoint = "/rest/1.0/myplugin/config"
values = "{"\key\": \"value\"}"
}
```
## Argument Reference
* `config_endpoint` - Required. Path to the configuration endpoint. Relative to the bitbucket server url configured in the provider.
* `values` - Required. Plugin configuration in JSON format.
## Import
Import a plugin config reference via the key:
```
terraform import bitbucketserver_plugin_config.mypluginkey my-plugin-key
```

View File

@@ -0,0 +1,30 @@
# Resource: bitbucketserver_project
Create a Bitbucket Project to hold repositories.
## Example Usage
```hcl
resource "bitbucketserver_project" "test" {
key = "TEST"
name = "test-01"
description = "Test project"
avatar = "data:(content type, e.g. image/png);base64,(data)"
}
```
## Argument Reference
* `key` - Required. Project key to set.
* `name` - Required. Name of the project.
* `description` - Optional. Description of the project.
* `avatar` - Optional. Avatar to use containing base64-encoded image data. Format: `data:(content type, e.g. image/png);base64,(data)`
* `public` - Optional. Flag to make the project public or private. Default `false`.
## Import
Import a project reference via the key:
```
terraform import bitbucketserver_project.test TEST
```

View File

@@ -0,0 +1,18 @@
# Resource: bitbucketserver_project_hook
Manage a project level hook. Extends what Bitbucket does every time a repository changes, for example when code is pushed or a pull request is merged.
## Example Usage
```hcl
resource "bitbucketserver_project_hook" "main" {
project = "MYPROJ"
hook = "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook"
}
```
## Argument Reference
* `project` - Required. Project Key the hook to enable is for.
* `hook` - Required. The hook to enable on the project.
* `settings` - Optional. Map of values to apply as settings for the hook. Contents dependant on the individual hook settings.

View File

@@ -0,0 +1,31 @@
# Resource: bitbucketserver_project_permissions_group
Set project level permissions for a given group.
## Example Usage
```hcl
resource "bitbucketserver_project_permissions_group" "my-proj" {
project = "MYPROJ"
group = "stash-users"
permission = "PROJECT_WRITE"
}
```
## Argument Reference
* `project` - Required. Project key to set permissions for.
* `group` - Required. Name of the group permissions are for.
* `permission` - Required. The permission to grant. Available project permissions are:
* `PROJECT_READ`
* `PROJECT_WRITE`
* `PROJECT_ADMIN`
## Import
Import a group project level permissions via the project & group names:
```
terraform import bitbucketserver_project_permissions_group.test MYPROJ/stash-users
```

View File

@@ -0,0 +1,31 @@
# Resource: bitbucketserver_project_permissions_user
Set project permissions for a given user.
## Example Usage
```hcl
resource "bitbucketserver_project_permissions_user" "mreynolds" {
project = "MYPROJ"
user = "mreynolds"
permission = "PROJECT_WRITE"
}
```
## Argument Reference
* `project` - Required. Name of the project to assign permissions to.
* `user` - Required. Name of the user permissions are for.
* `permission` - Required. The permission to grant. Available project permissions are:
* `PROJECT_READ`
* `PROJECT_WRITE`
* `PROJECT_ADMIN`
## Import
Import a user project permissions via the project and user name:
```
terraform import bitbucketserver_global_permissions_user.test MYPROJ/mreynolds
```

View File

@@ -0,0 +1,54 @@
# Resource: bitbucketserver_repository
Create a Bitbucket Repository.
## Example Usage
```hcl
resource "bitbucketserver_repository" "test" {
project = "MYPROJ"
name = "test-01"
description = "Test repository"
}
```
### Forking an existing repository
```hcl
resource "bitbucketserver_repository" "test" {
project = "MYPROJ"
name = "test-01"
description = "Test repository"
fork_repository_project = "MY-ORIGIN-PROJ"
fork_repository_slug = "MY-ORIGIN-REPO"
}
```
> Note: Both `fork_repository_project` and `fork_repository_slug` are required to specified the origin repository to fork.
## Argument Reference
* `project` - Required. Name of the project to create the repository in.
* `name` - Required. Name of the repository.
* `slug` - Optional. Slug to use for the repository. Calculated if not defined.
* `description` - Optional. Description of the repository.
* `forkable` - Optional. Enable/disable forks of this repository. Default `true`
* `public` - Optional. Determine if this repository is public. Default `false`
* `enable_git_lfs` - Optional. Enable git-lfs for this repository. Default `false`
* `fork_repository_project` - Optional. Use this to fork an existing repository from the given project.
* `fork_repository_slug` - Optional. Use this to fork an existing repository from the given repository.
## Attribute Reference
Additional to the above, the following attributes are emitted:
* `clone_ssh` - URL for SSH cloning of the repository.
* `clone_https` - URL for HTTPS cloning of the repository.
## Import
Import a repository using the project key and repository slug:
```
terraform import bitbucketserver_repository.test MYPROJ/test-01
```

View File

@@ -0,0 +1,20 @@
# Resource: bitbucketserver_repository_hook
Manage a repository level hook. Extends what Bitbucket does every time a repository changes, for example when code is pushed or a pull request is merged.
## Example Usage
```hcl
resource "bitbucketserver_repository_hook" "main" {
project = "MYPROJ"
repository = "repo1"
hook = "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook"
}
```
## Argument Reference
* `project` - Required. Project Key the repository is contained within.
* `repository` - Required. Repository slug to enable hook for.
* `hook` - Required. The hook to enable on the repository.
* `settings` - Optional. Map of values to apply as settings for the hook. Contents dependant on the individual hook settings.

View File

@@ -0,0 +1,33 @@
# Resource: bitbucketserver_repository_permissions_group
Set repository level permissions for a given group.
## Example Usage
```hcl
resource "bitbucketserver_repository_permissions_group" "my-repo" {
project = "MYPROJ"
repository = "repo1"
group = "stash-users"
permission = "REPO_WRITE"
}
```
## Argument Reference
* `project` - Required. Project key the repository is contained within.
* `repository` - Required. Repository slug to set the permissions for.
* `group` - Required. Name of the group permissions are for.
* `permission` - Required. The permission to grant. Available permissions are:
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`
## Import
Import a group project level permissions via the project & group names:
```
terraform import bitbucketserver_repository_permissions_group.test MYPROJ/repo1/stash-users
```

View File

@@ -0,0 +1,33 @@
# Resource: bitbucketserver_repository_permissions_user
Set repository permissions for a given user.
## Example Usage
```hcl
resource "bitbucketserver_repository_permissions_user" "mreynolds-repo" {
project = "MYPROJ"
repository = "repo1"
user = "mreynolds"
permission = "REPO_WRITE"
}
```
## Argument Reference
* `project` - Required. Project key the repository is contained within.
* `repository` - Required. Repository slug to set the permissions for.
* `user` - Required. Name of the user permissions are for.
* `permission` - Required. The permission to grant. Available project permissions are:
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`
## Import
Import a group project level permissions via the project & group names:
```
terraform import bitbucketserver_repository_permissions_user.test MYPROJ/repo1/mreynolds
```

View File

@@ -0,0 +1,33 @@
# Resource: bitbucketserver_user
Create a Bitbucket user.
## Example Usage
```hcl
resource "bitbucketserver_user" "admin" {
name = "mreynolds"
display_name = "Malcolm Reynolds"
email_address = "browncoat@example.com"
}
```
## Argument Reference
* `name` - Required. Username of the user.
* `display_name` - Required. User's name to display.
* `email_address` - Required. Email address of user.
* `password_length` - Optional. The length of the generated password on resource creation. Only applies on resource creation. Default `20`.
## Attribute Reference
* `initial_password` - The generated user password. Only available if password was handled on Terraform resource creation, not import.
* `user_id` - The user ID.
## Import
Import a user reference via the user's name.
```
terraform import bitbucketserver_user.test mreynolds
```

View File

@@ -0,0 +1,45 @@
# Resource: bitbucketserver_user_access_token
Personal access tokens can be used to replace passwords over https, or to authenticate using the Bitbucket Server REST API over Basic Auth.
For git operations, you can use your personal access token as a substitute for your password.
> Note: You can only create access tokens for your user account - i.e. the one that the provisioner has been configured to authenticate with!
> This is a restriction in the Bitbucket APIs.
## Example Usage
```hcl
resource "bitbucketserver_user_access_token" "token" {
user = "admin"
name = "my-token"
permissions = ["REPO_READ", "PROJECT_ADMIN"]
}
```
## Argument Reference
* `user` - Required. Username of the user.
* `name` - Required. Name of the access token.
* `permissions` - Required. List of permissions to grant the access token.
* `PROJECT_READ`
* `PROJECT_WRITE`
* `PROJECT_ADMIN`
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`
## Attribute Reference
* `access_token` - The generated access token. Only available if token was generated on Terraform resource creation, not import/update.
* `created_date` - When the access token was generated.
* `last_authenticated` - When the access token was last used for authentication.
## Import
Import a user token reference via the token id.
```
terraform import bitbucketserver_user_access_token.test 413460754380
```

View File

@@ -0,0 +1,25 @@
# Resource: bitbucketserver_user_group
Assign a User to an existing Bitbucket Group.
## Example Usage
```hcl
resource "bitbucketserver_user_group" "browncoat" {
user = "mreynolds"
group = "browncoats"
}
```
## Argument Reference
* `user` - Required. User to assign group to.
* `group` - Required. Group to assign to the user.
## Import
Import a user group reference via the user and group keys:
```
terraform import bitbucketserver_user_group.browncoat mreynolds/browncoats
```