From 78116ee73840fa9ad42258430a3e0fd88b9aab5a Mon Sep 17 00:00:00 2001 From: uk-bolly <69214557+uk-bolly@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:30:45 +0100 Subject: [PATCH] added new ssh connection --- .github/workflows/main.tf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/main.tf b/.github/workflows/main.tf index 29fd6f3..4123d04 100644 --- a/.github/workflows/main.tf +++ b/.github/workflows/main.tf @@ -59,6 +59,20 @@ resource "aws_instance" "testing_vm" { root_block_device { delete_on_termination = true } + # SSH into instance - will ensure server is up before next step in workflows + connection { + # Host name + host = self.public_ip + # The default username for our AMI + user = var.ami_username + # Private key for connection + private_key = "${file(var.private_key)}" + # Type of connection + type = "ssh" + } + provisioner "remote-exec" { + inline = [ "echo hello_world"] + } } // generate inventory file