Is there any way I can execute a command on remote machine with Terraform and have the result of that command show me by output? I can use provisioner(remote-exec) to install and run commands on remote machine but couldn't find a way to the result of the command show me by output.
Thank you for your time guys.
You could do what you want with External Data Source. You would have to program the external data source to run the commands on the remote host and return what you want return for further processing in your TF code.
Other possibility is to have your remote-exec
populate an external parameter store (e.g. SSM Parameter Store in AWS), and then once your
remote-exec
finishes, you would fetch the data from it using aws_ssm_parameter data source.