Skip to content

Commit cdbb68b

Browse files
committed
fix: add network interface to htcondor execute point module + update htcondor templates version
1 parent 0055113 commit cdbb68b

File tree

7 files changed

+51
-14
lines changed

7 files changed

+51
-14
lines changed

community/modules/compute/htcondor-execute-point/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ limitations under the License.
212212
213213
| Name | Source | Version |
214214
|------|--------|---------|
215-
| <a name="module_execute_point_instance_template"></a> [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
215+
| <a name="module_execute_point_instance_template"></a> [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | >= 12.1 |
216216
| <a name="module_gpu"></a> [gpu](#module\_gpu) | ../../../../modules/internal/gpu-definition | n/a |
217-
| <a name="module_mig"></a> [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
217+
| <a name="module_mig"></a> [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | >= 12.1 |
218218
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |
219219
220220
## Resources
@@ -249,6 +249,7 @@ limitations under the License.
249249
| <a name="input_metadata"></a> [metadata](#input\_metadata) | Metadata to add to HTCondor execute points | `map(string)` | `{}` | no |
250250
| <a name="input_min_idle"></a> [min\_idle](#input\_min\_idle) | Minimum number of idle VMs in the HTCondor pool (if pool reaches var.max\_size, this minimum is not guaranteed); set to ensure jobs beginning run more quickly. | `number` | `0` | no |
251251
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Name prefix given to hostnames in this group of execute points; must be unique across all instances of this module | `string` | n/a | yes |
252+
| <a name="input_network_interfaces"></a> [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces to attach to HTCondor execute point instances.<br/>Each network interface should have the following fields:<br/>- network: The self link of the network (required)<br/>- subnetwork: The self link of the subnetwork (optional)<br/>If not specified, will use var.network\_self\_link and var.subnetwork\_self\_link for backward compatibility. | <pre>list(object({<br/> network = string<br/> subnetwork = optional(string)<br/> }))</pre> | `[]` | no |
252253
| <a name="input_network_self_link"></a> [network\_self\_link](#input\_network\_self\_link) | The self link of the network HTCondor execute points will join | `string` | `"default"` | no |
253254
| <a name="input_network_storage"></a> [network\_storage](#input\_network\_storage) | An array of network attached storage mounts to be configured | <pre>list(object({<br/> server_ip = string,<br/> remote_mount = string,<br/> local_mount = string,<br/> fs_type = string,<br/> mount_options = string,<br/> client_install_runner = map(string)<br/> mount_runner = map(string)<br/> }))</pre> | `[]` | no |
254255
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HTCondor execute points will be created | `string` | n/a | yes |

community/modules/compute/htcondor-execute-point/main.tf

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ locals {
115115
)
116116

117117
name_prefix = "${var.deployment_name}-${var.name_prefix}-ep"
118+
119+
# Handle backward compatibility for network configuration
120+
network_interfaces = length(var.network_interfaces) > 0 ? var.network_interfaces : [
121+
{
122+
network = var.network_self_link
123+
subnetwork = var.subnetwork_self_link
124+
}
125+
]
118126
}
119127

120128
data "google_compute_zones" "available" {
@@ -147,12 +155,23 @@ module "startup_script" {
147155

148156
module "execute_point_instance_template" {
149157
source = "terraform-google-modules/vm/google//modules/instance_template"
150-
version = "~> 12.1"
158+
version = ">= 12.1"
151159

152160
name_prefix = local.name_prefix
153161
project_id = var.project_id
154-
network = var.network_self_link
155-
subnetwork = var.subnetwork_self_link
162+
region = var.region
163+
network = local.network_interfaces[0].network
164+
subnetwork = local.network_interfaces[0].subnetwork
165+
166+
additional_networks = [
167+
for network_interface in slice(local.network_interfaces, 1, length(local.network_interfaces)) : {
168+
network = network_interface.network
169+
subnetwork = network_interface.subnetwork
170+
subnetwork_project = var.project_id
171+
access_config = []
172+
}
173+
]
174+
156175
service_account = {
157176
email = var.execute_point_service_account_email
158177
scopes = var.service_account_scopes
@@ -175,7 +194,7 @@ module "execute_point_instance_template" {
175194

176195
module "mig" {
177196
source = "terraform-google-modules/vm/google//modules/mig"
178-
version = "~> 12.1"
197+
version = ">= 12.1"
179198

180199
project_id = var.project_id
181200
region = var.region

community/modules/compute/htcondor-execute-point/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ variable "subnetwork_self_link" {
135135
default = null
136136
}
137137

138+
variable "network_interfaces" {
139+
description = <<-EOT
140+
A list of network interfaces to attach to HTCondor execute point instances.
141+
Each network interface should have the following fields:
142+
- network: The self link of the network (required)
143+
- subnetwork: The self link of the subnetwork (optional)
144+
If not specified, will use var.network_self_link and var.subnetwork_self_link for backward compatibility.
145+
EOT
146+
type = list(object({
147+
network = string
148+
subnetwork = optional(string)
149+
}))
150+
default = []
151+
}
152+
138153
variable "target_size" {
139154
description = "Initial size of the HTCondor execute point pool; set to null (default) to avoid Terraform management of size."
140155
type = number

community/modules/scheduler/htcondor-access-point/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ limitations under the License.
122122
123123
| Name | Source | Version |
124124
|------|--------|---------|
125-
| <a name="module_access_point_instance_template"></a> [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
126-
| <a name="module_htcondor_ap"></a> [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
125+
| <a name="module_access_point_instance_template"></a> [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | >= 12.1 |
126+
| <a name="module_htcondor_ap"></a> [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | >= 12.1 |
127127
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |
128128
129129
## Resources

community/modules/scheduler/htcondor-access-point/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,11 @@ resource "google_compute_address" "ap" {
242242

243243
module "access_point_instance_template" {
244244
source = "terraform-google-modules/vm/google//modules/instance_template"
245-
version = "~> 12.1"
245+
version = ">= 12.1"
246246

247247
name_prefix = local.name_prefix
248248
project_id = var.project_id
249+
region = var.region
249250
network = var.network_self_link
250251
subnetwork = var.subnetwork_self_link
251252
service_account = {
@@ -279,7 +280,7 @@ module "access_point_instance_template" {
279280

280281
module "htcondor_ap" {
281282
source = "terraform-google-modules/vm/google//modules/mig"
282-
version = "~> 12.1"
283+
version = ">= 12.1"
283284

284285
project_id = var.project_id
285286
region = var.region

community/modules/scheduler/htcondor-central-manager/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ limitations under the License.
106106

107107
| Name | Source | Version |
108108
|------|--------|---------|
109-
| <a name="module_central_manager_instance_template"></a> [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
110-
| <a name="module_htcondor_cm"></a> [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
109+
| <a name="module_central_manager_instance_template"></a> [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | >= 12.1 |
110+
| <a name="module_htcondor_cm"></a> [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | >= 12.1 |
111111
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |
112112

113113
## Resources

community/modules/scheduler/htcondor-central-manager/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ resource "google_compute_address" "cm" {
149149

150150
module "central_manager_instance_template" {
151151
source = "terraform-google-modules/vm/google//modules/instance_template"
152-
version = "~> 12.1"
152+
version = ">= 12.1"
153153

154154
name_prefix = local.name_prefix
155155
project_id = var.project_id
156+
region = var.region
156157
network = var.network_self_link
157158
subnetwork = var.subnetwork_self_link
158159
service_account = {
@@ -177,7 +178,7 @@ module "central_manager_instance_template" {
177178

178179
module "htcondor_cm" {
179180
source = "terraform-google-modules/vm/google//modules/mig"
180-
version = "~> 12.1"
181+
version = ">= 12.1"
181182

182183
project_id = var.project_id
183184
region = var.region

0 commit comments

Comments
 (0)