Woozar
Woozar

Reputation: 1130

How to extract an archive using terraform

I am trying to deploy a website on azure storage. For that I need to

I can do every step but extracting the archive. Can somebody tell me how to extract an zip or tarball archive using terraform?

Upvotes: 3

Views: 5755

Answers (1)

you might use null_resource with the provisioner "local-exec" inside to do so. It might be any command line or simple bash script wrapper. https://www.terraform.io/docs/language/resources/provisioners/local-exec.html

resource "null_resource" "extract_my_tgz" {
  provisioner "local-exec" {
    command = "tar xzf my_file.tgz"
  }
}

there same you might use for zip files as well.

resource "null_resource" "extract_my_zip" {
  provisioner "local-exec" {
    command = "unzip my_file.zip"
  }
}

Upvotes: 1

Related Questions