From b3cf41af6ff76dffdf797ade06eee838b56b6492 Mon Sep 17 00:00:00 2001 From: uk-bolly <69214557+uk-bolly@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:30:09 +0100 Subject: [PATCH] changed to local file lookup --- .github/workflows/main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.tf b/.github/workflows/main.tf index b284d24..555f23d 100644 --- a/.github/workflows/main.tf +++ b/.github/workflows/main.tf @@ -3,6 +3,11 @@ provider "aws" { region = var.aws_region } +// Read local file not created via terraform +data "local_file" "github_actions" { + filename = "${path.module}/${var.private_key}" +} + // Create a security group with access to port 22 and port 80 open to serve HTTP traffic data "aws_vpc" "default" { @@ -66,7 +71,7 @@ resource "aws_instance" "testing_vm" { # The default username for our AMI user = var.ami_username # Private key for connection - private_key = file(".ssh/github_actions.pem") + private_key = data.local_file.github_actions.content # Type of connection type = "ssh" }