For HT
# String, rounds of "encryption"
go run encrypt.go secret 3
# String, rounds of "encryption"
./encrypt.py secret 3
# String, rounds of "encryption"
./encrypt.sh secret 3
# First, compile the class because this is fucking Java
$ javac Encrypt.java
# String, rounds of "encryption"
$ java Encrypt secret 3
# String, rounds of "encryption"
node ./encrypt.js secret 3
# String, rounds of "encryption"
./encrypt.rb secret 3
Interactively
$ terraform init && terraform apply -auto-approve
var.input
Enter a value: secret
var.times
Enter a value: 3
null_resource.encrypt: Creating...
null_resource.encrypt: Provisioning with 'local-exec'...
null_resource.encrypt (local-exec): Executing: ["/bin/sh" "-c" "./encrypt.py secret 3"]
null_resource.encrypt (local-exec): "encrypted" WXpKV2FtTnRWakE9
null_resource.encrypt (local-exec): "decrypted" secret
null_resource.encrypt: Creation complete after 0s [id=2042342408304500010]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Supply values on the CLI
$ terraform apply -var input=secret -var times=3 -auto-approve
null_resource.encrypt: Creating...
null_resource.encrypt: Provisioning with 'local-exec'...
null_resource.encrypt (local-exec): Executing: ["/bin/sh" "-c" "./encrypt.py secret 3"]
null_resource.encrypt (local-exec): "encrypted" WXpKV2FtTnRWakE9
null_resource.encrypt (local-exec): "decrypted" secret
null_resource.encrypt: Creation complete after 0s [id=8726143734733607353]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Use a tfvars
file
Sample terraform.tfvars
input="secret"
times=1
# Only run if it exists
$ test -f terraform.tfvars && terraform apply -auto-approve
null_resource.encrypt: Creating...
null_resource.encrypt: Provisioning with 'local-exec'...
null_resource.encrypt (local-exec): Executing: ["/bin/sh" "-c" "./encrypt.py secret 3"]
null_resource.encrypt (local-exec): "encrypted" WXpKV2FtTnRWakE9
null_resource.encrypt (local-exec): "decrypted" secret
null_resource.encrypt: Creation complete after 0s [id=3935885297718964381]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
ansible-playbook ./encrypt.yaml
puppet apply ./encrypt.pp