Skip to content

Commit 73e0215

Browse files
committed
Allow user to specify connector subnet range.
1 parent 5195426 commit 73e0215

4 files changed

Lines changed: 25 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.4.6 (Feb 27, 2026)
2+
* Allow user to specify connector subnet range.
3+
14
# 0.4.5 (Feb 19, 2026)
25
* Added `var.vpc_flow_logs` to enable and configure VPC Flow logs on the network.
36

outputs.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ output "private_subnet_self_links" {
4848
description = "list(string) ||| The self_link of each private subnet"
4949
}
5050

51+
output "connector_subnet_name" {
52+
value = google_compute_subnetwork.access_connector.name
53+
description = "string ||| The name of the private access connector subnet"
54+
}
55+
56+
output "connector_subnet_id" {
57+
value = google_compute_subnetwork.access_connector.id
58+
description = "string ||| The ID of the private access connector subnet"
59+
}
60+
61+
output "connector_subnet_self_link" {
62+
value = google_compute_subnetwork.access_connector.self_link
63+
description = "string ||| The self_link of the private access connector subnet"
64+
}
65+
5166
output "nat_id" {
5267
value = google_compute_router_nat.this.id
5368
description = "string ||| Id of Cloud NAT"

subnets.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ resource "google_compute_subnetwork" "private" {
4242

4343
resource "google_compute_subnetwork" "access_connector" {
4444
name = "${local.resource_name}-connector-0"
45-
ip_cidr_range = local.connector_subnet
45+
ip_cidr_range = var.connector_subnet
4646
network = google_compute_network.this.name
4747
region = data.google_compute_zones.available.region
4848
private_ip_google_access = true

variables.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ variable "private_subnets" {
1010
default = ["10.102.0.0/16"]
1111
}
1212

13+
variable "connector_subnet" {
14+
type = string
15+
default = "10.128.0.0/28"
16+
description = "Network range for the connector subnet created in the VPC. This subnet is used for private access to GCP-managed services like CloudSQL."
17+
}
18+
1319
variable "internal_subdomain" {
1420
type = string
1521
default = ""
@@ -18,10 +24,6 @@ When specified, creates a private Google Cloud DNS zone that allows internal DNS
1824
EOF
1925
}
2026

21-
locals {
22-
connector_subnet = "10.128.0.0/28"
23-
}
24-
2527
variable "vpc_flow_logs" {
2628
type = object({
2729
enabled = bool

0 commit comments

Comments
 (0)