Google Cloud Build Private Pool Module#
This Terraform module creates and manages a Google Cloud Build private worker pool, allowing you to run Cloud Build jobs in a custom VPC network environment, such as a shared VPC network. This requires the shared network to be configured with a peered network IP range, and pre-defined, with enough IP addresses available for the worker pool.
Compatibility#
This module is compatible with Terraform version ~> 1.0 and has been tested with the following provider versions:
- Google Provider:
~> 7.0 - Google Beta Provider:
~> 7.0
Usage#
This module enables you to create Cloud Build private worker pools with the following key features:
- Creates a Cloud Build private worker pool with configurable machine types
- Supports VPC network peering for secure connectivity
- Configurable disk size and network settings
- Option to disable external IP addresses for enhanced security
- Integration with shared VPC networks
Basic Example#
module "private_pool" {
source = "github.com/myops-co/gcp-terraform-modules//modules/terraform-google-private-pool?ref=vX.Y.Z"
project_id = "my-project-id"
name = "ci-private-pool"
location = "europe-west1"
machine_type = "e2-standard-4"
disk_size_gb = "100"
no_external_ip = true
shared_net = "projects/my-shared-vpc-project/global/networks/shared-vpc-network"
peered_network_ip_range = "/28"
}
Advanced Example with Custom Configuration#
module "private_pool" {
source = "github.com/myops-co/gcp-terraform-modules//modules/terraform-google-private-pool?ref=vX.Y.Z"
project_id = "my-project-id"
name = "production-build-pool"
location = "europe-west1"
machine_type = "e2-highmem-8"
disk_size_gb = "200"
no_external_ip = false
shared_net = "projects/my-shared-vpc-project/global/networks/production-vpc"
peered_network_ip_range = "/24"
# Additional labels for resource management
labels = {
environment = "production"
team = "devops"
purpose = "ci-cd"
}
}
Software#
This module requires the following software dependencies:
- Terraform
~> 1.0 - Google Cloud Provider
~> 7.0 - Google Cloud Beta Provider
~> 7.0
Service Account#
The service account used to run this module must have the following IAM roles:
roles/cloudbuild.workerPoolAdmin- To create and manage Cloud Build worker poolsroles/compute.networkAdmin- To configure VPC network peeringroles/serviceusage.serviceUsageAdmin- To enable required APIs
APIs#
The following GCP APIs must be enabled in the target project:
- Cloud Build API (
cloudbuild.googleapis.com) - Compute Engine API (
compute.googleapis.com) - Service Usage API (
serviceusage.googleapis.com)
License#
This module is covered by a commercial license. Please see LICENSE for details.
Support#
This module is developed and maintained by MyOps Limited. For any support inquiries, please contact us at info@myops.co.il.
Requirements#
| Name | Version |
|---|---|
| terraform | ~> 1 |
| ~> 7 | |
| google-beta | ~> 7 |
Providers#
| Name | Version |
|---|---|
| ~> 7 |
Modules#
No modules.
Resources#
| Name | Type |
|---|---|
| google_cloudbuild_worker_pool.private_pool | resource |
Inputs#
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| disk_size_gb | Worker dsik size in GB | string |
"100" |
no |
| location | Location private_pool | string |
n/a | yes |
| machine_type | Worker machine type | string |
"e2-standard-2" |
no |
| name | Name of private_pool | string |
n/a | yes |
| no_external_ip | No external IP is configured | bool |
true |
no |
| peered_network_ip_range | Subnet IP range within the peered network. This is specified in CIDR notation with a slash and the subnet prefix size. You can optionally specify an IP address before the subnet prefix value. e.g. 192.168.0.0/29 would specify an IP range starting at 192.168.0.0 with a prefix size of 29 bits. /16 would specify a prefix size of 16 bits, with an automatically determined IP within the peered VPC. If unspecified, a value of /24 will be used. | string |
"" |
no |
| project_id | Project ID | string |
n/a | yes |
| shared_net | Shared VPC id | string |
null |
no |
Outputs#
| Name | Description |
|---|---|
| id | Cloud Build worker pool ID |