Terraform module to easily execute scripts via SSH with many customizable features
A basic usage of the module is as follows:
module "template" {
source = "thereisnotime/terraform-ssh-executor"
version = "x.x.x" # Replace with the latest version
depends_on = [module.ec2_vm] # The resources that the script depends on, usually your virtual machine.
script_location = "${path.module}/../../scripts/setup-generic.sh" # The location of the script to run.
ssh_private_key = tls_private_key.tf_rsa_key.private_key_openssh # The private key to connect to the remote machine.
ssh_host = "192.168.3.5" # The IP address of the remote machine.
deploy_on_script_change = true # Set to true if you want Terraform to re-apply every time your script has changes.
ssh_user = "terraform" # The user to connect to the remote machine.
recreate_hook = module.ec2_warden_vm.instance_arn # In case you want the script to re-create itself if another resource changes.
wait_before_deploy = true # Set to true if you want Terraform to wait for some time before running.
wait_seconds = 30 # How many seconds to wait before running the script.
}
TODO
TODO
Contributions are very welcomed!
Start by reviewing contribution guide and our code of conduct. After that, start coding and ship your changes by creating a new PR.
- Add simple and complete examples.
- Add examples for PowerShell.
- Add examples for sshpass.
Apache 2 Licensed. See LICENSE for full details.
Made with contrib.rocks.