starhawking / python-terrascript

Create Terraform files using Python scripts.
BSD 2-Clause "Simplified" License
516 stars 76 forks source link

Is there any support for "null_resource" in terrascript? #68

Closed andrew-lee-1089 closed 5 years ago

andrew-lee-1089 commented 5 years ago

Cool module!

I have a terraform file that has the following resource:

resource "null_resource" "configdrive" {
  provisioner "local-exec" {
    command = "python ../configdrive.py ${local_file.user_data.filename} ${var.node_name}"
  }

Is there anyway to express null_resources via terrascript?

Thanks!

andrew-lee-1089 commented 5 years ago

I think I've solved this myself with:

    prov = provisioner("local-exec", command="python configdrive.py ${local_file.user_data_json[count.index].filename} ${var.node_names[count.index]}")
    null_resource = resource("null_resource", "configdrive", count=2, provisioner=prov)