Skip to content

googleCloudbuildBitbucketServerConfig

BitbucketServerConfig represents the configuration for a Bitbucket Server.

To get more information about BitbucketServerConfig, see:

Example Usage - Cloudbuild Bitbucket Server Config

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.cloudbuildBitbucketServerConfig.CloudbuildBitbucketServerConfig(
  this,
  "bbs-config",
  {
    api_key: "<api-key>",
    config_id: "mybbsconfig",
    host_uri: "https://bbs.com",
    location: "us-central1",
    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",
  }
);

Example Usage - Cloudbuild Bitbucket Server Config Repositories

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.cloudbuildBitbucketServerConfig.CloudbuildBitbucketServerConfig(
  this,
  "bbs-config-with-repos",
  {
    api_key: "<api-key>",
    config_id: "mybbsconfig",
    connected_repositories: [
      {
        project_key: "DEV",
        repo_slug: "repo1",
      },
      {
        project_key: "PROD",
        repo_slug: "repo1",
      },
    ],
    host_uri: "https://bbs.com",
    location: "us-central1",
    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",
  }
);

Example Usage - Cloudbuild Bitbucket Server Config Peered Network

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleProjectServiceServicenetworking =
  new google.projectService.ProjectService(this, "servicenetworking", {
    disable_on_destroy: false,
    service: "servicenetworking.googleapis.com",
  });
const dataGoogleComputeNetworkVpcNetwork =
  new google.dataGoogleComputeNetwork.DataGoogleComputeNetwork(
    this,
    "vpc_network",
    {
      depends_on: [`\${${googleProjectServiceServicenetworking.fqn}}`],
      name: "vpc-network",
    }
  );
const dataGoogleProjectProject = new google.dataGoogleProject.DataGoogleProject(
  this,
  "project",
  {}
);
const googleComputeGlobalAddressPrivateIpAlloc =
  new google.computeGlobalAddress.ComputeGlobalAddress(
    this,
    "private_ip_alloc",
    {
      address_type: "INTERNAL",
      name: "private-ip-alloc",
      network: dataGoogleComputeNetworkVpcNetwork.id,
      prefix_length: 16,
      purpose: "VPC_PEERING",
    }
  );
const googleServiceNetworkingConnectionDefault =
  new google.serviceNetworkingConnection.ServiceNetworkingConnection(
    this,
    "default",
    {
      depends_on: [`\${${googleProjectServiceServicenetworking.fqn}}`],
      network: dataGoogleComputeNetworkVpcNetwork.id,
      reserved_peering_ranges: [googleComputeGlobalAddressPrivateIpAlloc.name],
      service: "servicenetworking.googleapis.com",
    }
  );
new google.cloudbuildBitbucketServerConfig.CloudbuildBitbucketServerConfig(
  this,
  "bbs-config-with-peered-network",
  {
    api_key: "<api-key>",
    config_id: "mybbsconfig",
    depends_on: [`\${${googleServiceNetworkingConnectionDefault.fqn}}`],
    host_uri: "https://bbs.com",
    location: "us-central1",
    peered_network: `\${replace(${dataGoogleComputeNetworkVpcNetwork.id}, ${dataGoogleProjectProject.name}, ${dataGoogleProjectProject.number})}`,
    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",
      },
    ],
    ssl_ca:
      "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n",
    username: "test",
  }
);

Argument Reference

The following arguments are supported:

  • hostUri - (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.

  • apiKey - (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.

  • configId - (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.

The secrets block supports:

  • adminAccessTokenVersionName - (Required) The resource name for the admin access token's secret version.

  • readAccessTokenVersionName - (Required) The resource name for the read access token's secret version.

  • webhookSecretVersionName - (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.


  • connectedRepositories - (Optional) Connected Bitbucket Server repositories for this config. Structure is documented below.

  • peeredNetwork - (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.

  • sslCa - (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 connectedRepositories block supports:

  • projectKey - (Required) Identifier for the project storing the repository.

  • repoSlug - (Required) Identifier for the repository.

Attributes Reference

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/{{configId}}

  • name - The resource name for the config.

  • webhookKey - Output only. UUID included in webhook requests. The UUID is used to look up the corresponding config.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

BitbucketServerConfig can be imported using any of these accepted formats:

$ 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}}

User Project Overrides

This resource supports User Project Overrides.