Skip to content

Instantly share code, notes, and snippets.

@grahamlyons
Created June 16, 2017 08:44
Show Gist options
  • Save grahamlyons/3c3ba4fe4cbee3f50ecf6b74cc4c427c to your computer and use it in GitHub Desktop.
Save grahamlyons/3c3ba4fe4cbee3f50ecf6b74cc4c427c to your computer and use it in GitHub Desktop.
Terraform Provisioner
resource "random_id" "id" {
byte_length = 8
provisioner "local-exec" {
command = "./provision.sh ${self.id}"
}
}
#!/bin/sh
set -euo pipefail
echo "provisioning ${1}" > output.txt
for i in 1 2 3 4 5
do
echo ${i} >> output.txt
sleep 1
done
@grahamlyons
Copy link
Author

Run with:

docker run --rm -v "$(pwd)":"$(pwd)" -w "$(pwd)" hashicorp/terraform apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment