BitbucketServerConfig represents the configuration for a Bitbucket Server.
To get more information about BitbucketServerConfig, see:
resource "google_cloudbuild_bitbucket_server_config" "bbs-config" {
config_id = "bbs-config"
location = "us-central1"
host_uri = "https://bbs.com"
secrets {
admin_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
read_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
webhook_secret_version_name = "projects/myProject/secrets/mybbspat/versions/1"
}
username = "test"
api_key = "<api-key>"
}
resource "google_cloudbuild_bitbucket_server_config" "bbs-config-with-repos" {
config_id = "bbs-config"
location = "us-central1"
host_uri = "https://bbs.com"
secrets {
admin_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
read_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
webhook_secret_version_name = "projects/myProject/secrets/mybbspat/versions/1"
}
username = "test"
api_key = "<api-key>"
connected_repositories {
project_key = "DEV"
repo_slug = "repo1"
}
connected_repositories {
project_key = "PROD"
repo_slug = "repo1"
}
}
data "google_project" "project" {}
resource "google_project_service" "servicenetworking" {
service = "servicenetworking.googleapis.com"
disable_on_destroy = false
}
resource "google_compute_network" "vpc_network" {
name = "vpc-network"
depends_on = [google_project_service.servicenetworking]
}
resource "google_compute_global_address" "private_ip_alloc" {
name = "private-ip-alloc"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.vpc_network.id
}
resource "google_service_networking_connection" "default" {
network = google_compute_network.vpc_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
depends_on = [google_project_service.servicenetworking]
}
resource "google_cloudbuild_bitbucket_server_config" "bbs-config-with-peered-network" {
config_id = "bbs-config"
location = "us-central1"
host_uri = "https://bbs.com"
secrets {
admin_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
read_access_token_version_name = "projects/myProject/secrets/mybbspat/versions/1"
webhook_secret_version_name = "projects/myProject/secrets/mybbspat/versions/1"
}
username = "test"
api_key = "<api-key>"
peered_network = replace(google_compute_network.vpc_network.id, data.google_project.project.name, data.google_project.project.number)
ssl_ca = "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n"
depends_on = [google_service_networking_connection.default]
}
The following arguments are supported:
host_uri
-
(Required)
Immutable. The URI of the Bitbucket Server host. Once this field has been set, it cannot be changed.
If you need to change it, please create another BitbucketServerConfig.
secrets
-
(Required)
Secret Manager secrets needed by the config.
Structure is documented below.
username
-
(Required)
Username of the account Cloud Build will use on Bitbucket Server.
api_key
-
(Required)
Immutable. API Key that will be attached to webhook. Once this field has been set, it cannot be changed.
Changing this field will result in deleting/ recreating the resource.
config_id
-
(Required)
The ID to use for the BitbucketServerConfig, which will become the final component of the BitbucketServerConfig's resource name.
location
-
(Required)
The location of this bitbucket server config.
admin_access_token_version_name
-
(Required)
The resource name for the admin access token's secret version.
read_access_token_version_name
-
(Required)
The resource name for the read access token's secret version.
webhook_secret_version_name
-
(Required)
Immutable. The resource name for the webhook secret's secret version. Once this field has been set, it cannot be changed.
Changing this field will result in deleting/ recreating the resource.
connected_repositories
-
(Optional)
Connected Bitbucket Server repositories for this config.
Structure is documented below.
peered_network
-
(Optional)
The network to be used when reaching out to the Bitbucket Server instance. The VPC network must be enabled for private service connection.
This should be set if the Bitbucket Server instance is hosted on-premises and not reachable by public internet. If this field is left empty,
no network peering will occur and calls to the Bitbucket Server instance will be made over the public internet. Must be in the format
projects/{project}/global/networks/{network}, where {project} is a project number or id and {network} is the name of a VPC network in the project.
ssl_ca
-
(Optional)
SSL certificate to use for requests to Bitbucket Server. The format should be PEM format but the extension can be one of .pem, .cer, or .crt.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The connected_repositories
block supports:
project_key
-
(Required)
Identifier for the project storing the repository.
repo_slug
-
(Required)
Identifier for the repository.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}
name
-
The resource name for the config.
webhook_key
-
Output only. UUID included in webhook requests. The UUID is used to look up the corresponding config.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.BitbucketServerConfig can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}
{{project}}/{{location}}/{{config_id}}
{{location}}/{{config_id}}
In Terraform v1.5.0 and later, use an import
block to import BitbucketServerConfig using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}"
to = google_cloudbuild_bitbucket_server_config.default
}
When using the terraform import
command, BitbucketServerConfig can be imported using one of the formats above. For example:
$ terraform import google_cloudbuild_bitbucket_server_config.default projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}
$ terraform import google_cloudbuild_bitbucket_server_config.default {{project}}/{{location}}/{{config_id}}
$ terraform import google_cloudbuild_bitbucket_server_config.default {{location}}/{{config_id}}
This resource supports User Project Overrides.