@@ -352,17 +352,12 @@ func loadResourcesLibucl(o *libucl.Object) ([]*Resource, error) {
352352 err )
353353 }
354354
355- // Remove the "count" from the config, since we treat that special
355+ // Remove the fields we handle specially
356+ delete (config , "connection" )
356357 delete (config , "count" )
357-
358- // Delete the "provisioner" section from the config since
359- // that is treated specially.
358+ delete (config , "depends_on" )
360359 delete (config , "provisioner" )
361360
362- // Delete the "connection" section since we handle that
363- // seperately
364- delete (config , "connection" )
365-
366361 rawConfig , err := NewRawConfig (config )
367362 if err != nil {
368363 return nil , fmt .Errorf (
@@ -401,6 +396,20 @@ func loadResourcesLibucl(o *libucl.Object) ([]*Resource, error) {
401396 }
402397 }
403398
399+ // If we have depends fields, then add those in
400+ var dependsOn []string
401+ if deps := r .Get ("depends_on" ); deps != nil {
402+ err := deps .Decode (& dependsOn )
403+ deps .Close ()
404+ if err != nil {
405+ return nil , fmt .Errorf (
406+ "Error reading depends_on for %s[%s]: %s" ,
407+ t .Key (),
408+ r .Key (),
409+ err )
410+ }
411+ }
412+
404413 // If we have provisioners, then parse those out
405414 var provisioners []* Provisioner
406415 if po := r .Get ("provisioner" ); po != nil {
@@ -422,6 +431,7 @@ func loadResourcesLibucl(o *libucl.Object) ([]*Resource, error) {
422431 Count : count ,
423432 RawConfig : rawConfig ,
424433 Provisioners : provisioners ,
434+ DependsOn : dependsOn ,
425435 })
426436 }
427437 }
0 commit comments