Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/job-exec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ Functional examples are included in the
| timeout | Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. | `string` | `"600s"` | no |
| volume\_mounts | Volume to mount into the container's filesystem. | <pre>list(object({<br> name = string<br> mount_path = string<br> }))</pre> | `[]` | no |
| volumes | A list of Volumes to make available to containers. | <pre>list(object({<br> name = string<br> cloud_sql_instance = object({<br> instances = set(string)<br> })<br> }))</pre> | `[]` | no |
| vpc\_access | VPC Access configuration to use for this Task. | <pre>list(object({<br> connector = string<br> egress = string<br> }))</pre> | `[]` | no |

vpc_access | VPC Access configuration to use for this Task. Supports either a VPC Connector or Direct Subnet Attachment. | <pre>list(object({<br> connector = optional(string)<br> egress = optional(string, "PRIVATE_RANGES_ONLY")<br> network = optional(string)<br> subnetwork = optional(string)<br> tags = optional(list(string), [])<br> }))</pre> | `[]` | no |
## Outputs

| Name | Description |
Expand Down
25 changes: 20 additions & 5 deletions modules/job-exec/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,31 @@ resource "google_cloud_run_v2_job" "job" {
}

dynamic "vpc_access" {
for_each = var.vpc_access
content {
connector = vpc_access.value["connector"]
egress = vpc_access.value["egress"]
}
for_each = var.vpc_access
content {
dynamic "connector" {
for_each = lookup(vpc_access.value, "connector", null) != null ? [1] : []
content {
connector = vpc_access.value["connector"]
egress = lookup(vpc_access.value, "egress", "PRIVATE_RANGES_ONLY")
}
}

dynamic "network_interfaces" {
for_each = lookup(vpc_access.value, "network", null) != null && lookup(vpc_access.value, "subnetwork", null) != null ? [1] : []
content {
network = vpc_access.value["network"]
subnetwork = vpc_access.value["subnetwork"]
tags = lookup(vpc_access.value, "tags", [])
}
}
}
}

}
}
}

data "google_client_config" "default" {}

resource "terracurl_request" "exec" {
Expand Down
11 changes: 7 additions & 4 deletions modules/job-exec/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,15 @@ variable "volume_mounts" {
}

variable "vpc_access" {
description = "VPC access settings for Cloud Run Job. Supports either a VPC Connector or direct subnet attachment."
type = list(object({
connector = string
egress = string
connector = optional(string)
egress = optional(string, "PRIVATE_RANGES_ONLY")
network = optional(string)
subnetwork = optional(string)
tags = optional(list(string), [])
}))
description = "VPC Access configuration to use for this Task."
default = []
default = []
}

variable "limits" {
Expand Down