I am creating cloud infrastructure using Terraform (e.g. AWS EC2 VM) and after VM creation, I am running a shell script on remote VM using provisioner(remote-exec).
Is there any way to capture the shell script output (from remote vm) and store it in Terraform output (state file on local/consul)?
I already tried Terraform's 'External Data Source' but I guess it works only with local scripts (not remote vm scripts). Please correct me in case I am wrong.
Thanks
Creation-time or Destroy-time provisioners in Terraform only apply once during the resource creation/destroy, not during updating or any other lifecycle. For that reason the output of the provisioners won't be available in the terraform state.
Reference : https://www.terraform.io/docs/provisioners/index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With