Terraform: Terraform refresh/plan/apply hangs on when using uuid()

Created on 2 Feb 2017  ยท  4Comments  ยท  Source: hashicorp/terraform

Hi there,

I have tried to use uuid() for generating a unique filename, what follows is a simplified example but it reproduces perfectly the issue

variable "filename" {}
resource "null_resource" "zip" {
  provisioner "local-exec" {
    command = "zip -r ${var.filename}.zip main.tf"
  }
}

Invoking the module

module "zip1" {
  source = "modules/example"
  filename = "test-${uuid()}"
}

launching terraform with plan/apply, it hangs on indefinitely.

Terraform Version: 0.8.4 on El Capitan 10.11.6 and 0.8.5 on RHEL7

bug core

Most helpful comment

Hi @grubernaut

Thank you for the tip.

I used a slightly different approach for being sure the value is different each time the module is invoked

resource "random_id" "random" {
  keepers {
    tm = "${timestamp()}"
  }
  byte_length = 8
}

and then using the hexadecimal output of the resource

filename = "file-${random_id.random.hex}"

All 4 comments

Hi @gurdulu, thanks for the issue!

It doesn't solve the issue, but I was able to workaround it by using the timestamp() interpolation function inside the local-exec provisioner.

Hi @grubernaut

Thank you for the tip.

I used a slightly different approach for being sure the value is different each time the module is invoked

resource "random_id" "random" {
  keepers {
    tm = "${timestamp()}"
  }
  byte_length = 8
}

and then using the hexadecimal output of the resource

filename = "file-${random_id.random.hex}"

Will be fixed by #11733. Thanks!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ketzacoatl picture ketzacoatl  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

c4milo picture c4milo  ยท  3Comments

darron picture darron  ยท  3Comments

shanmugakarna picture shanmugakarna  ยท  3Comments