@@ -119,9 +119,10 @@ locals {
119119}
120120
121121resource "google_storage_bucket_object" "config" {
122- bucket = data. google_storage_bucket . this . name
123- name = " ${ local . bucket_dir } /config.yaml"
124- content = yamlencode (local. config )
122+ bucket = data. google_storage_bucket . this . name
123+ name = " ${ local . bucket_dir } /config.yaml"
124+ content = yamlencode (local. config )
125+ source_md5hash = md5 (yamlencode (local. config ))
125126
126127 # Take dependency on all other "config artifacts" so creation of `config.yaml`
127128 # can be used as a signal for setup.py that "everything is ready".
@@ -141,25 +142,28 @@ resource "google_storage_bucket_object" "nodeset_config" {
141142 instance_properties = jsondecode (ns. instance_properties_json )
142143 }) }
143144
144- bucket = data. google_storage_bucket . this . name
145- name = " ${ local . bucket_dir } /nodeset_configs/${ each . key } .yaml"
146- content = yamlencode (each. value )
145+ bucket = data. google_storage_bucket . this . name
146+ name = " ${ local . bucket_dir } /nodeset_configs/${ each . key } .yaml"
147+ content = yamlencode (each. value )
148+ source_md5hash = md5 (yamlencode (each. value ))
147149}
148150
149151resource "google_storage_bucket_object" "nodeset_dyn_config" {
150152 for_each = { for ns in var . nodeset_dyn : ns . nodeset_name => ns }
151153
152- bucket = data. google_storage_bucket . this . name
153- name = " ${ local . bucket_dir } /nodeset_dyn_configs/${ each . key } .yaml"
154- content = yamlencode (each. value )
154+ bucket = data. google_storage_bucket . this . name
155+ name = " ${ local . bucket_dir } /nodeset_dyn_configs/${ each . key } .yaml"
156+ content = yamlencode (each. value )
157+ source_md5hash = md5 (yamlencode (each. value ))
155158}
156159
157160resource "google_storage_bucket_object" "nodeset_tpu_config" {
158161 for_each = { for n in var . nodeset_tpu [* ]. nodeset : n . nodeset_name => n }
159162
160- bucket = data. google_storage_bucket . this . name
161- name = " ${ local . bucket_dir } /nodeset_tpu_configs/${ each . key } .yaml"
162- content = yamlencode (each. value )
163+ bucket = data. google_storage_bucket . this . name
164+ name = " ${ local . bucket_dir } /nodeset_tpu_configs/${ each . key } .yaml"
165+ content = yamlencode (each. value )
166+ source_md5hash = md5 (yamlencode (each. value ))
163167}
164168
165169# ########
@@ -245,15 +249,17 @@ data "archive_file" "slurm_gcp_devel_compute_zip" {
245249}
246250
247251resource "google_storage_bucket_object" "devel" {
248- bucket = var. bucket_name
249- name = local. slurm_gcp_devel_zip_bucket
250- source = data. archive_file . slurm_gcp_devel_controller_zip . output_path
252+ bucket = var. bucket_name
253+ name = local. slurm_gcp_devel_zip_bucket
254+ source = data. archive_file . slurm_gcp_devel_controller_zip . output_path
255+ source_md5hash = data. archive_file . slurm_gcp_devel_controller_zip . output_md5
251256}
252257
253258resource "google_storage_bucket_object" "devel_compute" {
254- bucket = var. bucket_name
255- name = local. slurm_gcp_devel_compute_zip_bucket
256- source = data. archive_file . slurm_gcp_devel_compute_zip . output_path
259+ bucket = var. bucket_name
260+ name = local. slurm_gcp_devel_compute_zip_bucket
261+ source = data. archive_file . slurm_gcp_devel_compute_zip . output_path
262+ source_md5hash = data. archive_file . slurm_gcp_devel_compute_zip . output_md5
257263}
258264
259265# ##########
@@ -266,9 +272,10 @@ resource "google_storage_bucket_object" "controller_startup_scripts" {
266272 : replace (basename (x. filename ), " /[^a-zA-Z0-9-_]/" , " _" ) => x
267273 }
268274
269- bucket = var. bucket_name
270- name = format (" %s/slurm-controller-script-%s" , local. bucket_dir , each. key )
271- content = each. value . content
275+ bucket = var. bucket_name
276+ name = format (" %s/slurm-controller-script-%s" , local. bucket_dir , each. key )
277+ content = each. value . content
278+ source_md5hash = md5 (each. value . content )
272279}
273280
274281resource "google_storage_bucket_object" "nodeset_startup_scripts" {
@@ -280,9 +287,10 @@ resource "google_storage_bucket_object" "nodeset_startup_scripts" {
280287 name = format (" slurm-nodeset-%s-script-%s" , nodeset, replace (basename (s. filename ), " /[^a-zA-Z0-9-_]/" , " _" )) }
281288 ]]) : x . name => x . content }
282289
283- bucket = var. bucket_name
284- name = format (" %s/%s" , local. bucket_dir , each. key )
285- content = each. value
290+ bucket = var. bucket_name
291+ name = format (" %s/%s" , local. bucket_dir , each. key )
292+ content = each. value
293+ source_md5hash = md5 (each. value )
286294}
287295
288296resource "google_storage_bucket_object" "prolog_scripts" {
@@ -291,10 +299,11 @@ resource "google_storage_bucket_object" "prolog_scripts" {
291299 : replace (basename (x. filename ), " /[^a-zA-Z0-9-_]/" , " _" ) => x
292300 }
293301
294- bucket = var. bucket_name
295- name = format (" %s/slurm-prolog-script-%s" , local. bucket_dir , each. key )
296- content = each. value . content
297- source = each. value . source
302+ bucket = var. bucket_name
303+ name = format (" %s/slurm-prolog-script-%s" , local. bucket_dir , each. key )
304+ content = each. value . content
305+ source = each. value . source
306+ source_md5hash = each. value . content != null && each. value . content != " " ? md5 (each. value . content ) : filemd5 (each. value . source )
298307}
299308
300309resource "google_storage_bucket_object" "epilog_scripts" {
@@ -303,10 +312,11 @@ resource "google_storage_bucket_object" "epilog_scripts" {
303312 : replace (basename (x. filename ), " /[^a-zA-Z0-9-_]/" , " _" ) => x
304313 }
305314
306- bucket = var. bucket_name
307- name = format (" %s/slurm-epilog-script-%s" , local. bucket_dir , each. key )
308- content = each. value . content
309- source = each. value . source
315+ bucket = var. bucket_name
316+ name = format (" %s/slurm-epilog-script-%s" , local. bucket_dir , each. key )
317+ content = each. value . content
318+ source = each. value . source
319+ source_md5hash = each. value . content != null && each. value . content != " " ? md5 (each. value . content ) : filemd5 (each. value . source )
310320}
311321
312322resource "google_storage_bucket_object" "task_prolog_scripts" {
@@ -315,10 +325,11 @@ resource "google_storage_bucket_object" "task_prolog_scripts" {
315325 : replace (basename (x. filename ), " /[^a-zA-Z0-9-_]/" , " _" ) => x
316326 }
317327
318- bucket = var. bucket_name
319- name = format (" %s/slurm-task_prolog-script-%s" , local. bucket_dir , each. key )
320- content = each. value . content
321- source = each. value . source
328+ bucket = var. bucket_name
329+ name = format (" %s/slurm-task_prolog-script-%s" , local. bucket_dir , each. key )
330+ content = each. value . content
331+ source = each. value . source
332+ source_md5hash = each. value . content != null && each. value . content != " " ? md5 (each. value . content ) : filemd5 (each. value . source )
322333}
323334
324335resource "google_storage_bucket_object" "task_epilog_scripts" {
@@ -327,10 +338,11 @@ resource "google_storage_bucket_object" "task_epilog_scripts" {
327338 : replace (basename (x. filename ), " /[^a-zA-Z0-9-_]/" , " _" ) => x
328339 }
329340
330- bucket = var. bucket_name
331- name = format (" %s/slurm-task_epilog-script-%s" , local. bucket_dir , each. key )
332- content = each. value . content
333- source = each. value . source
341+ bucket = var. bucket_name
342+ name = format (" %s/slurm-task_epilog-script-%s" , local. bucket_dir , each. key )
343+ content = each. value . content
344+ source = each. value . source
345+ source_md5hash = each. value . content != null && each. value . content != " " ? md5 (each. value . content ) : filemd5 (each. value . source )
334346}
335347
336348# ###########################
0 commit comments