From 0c6feb1b67dc88825c6dddb8b97bc0321f3a518b Mon Sep 17 00:00:00 2001 From: Mark Bolwell Date: Tue, 26 Jul 2022 17:54:28 +0100 Subject: [PATCH] added local file option Signed-off-by: Mark Bolwell --- .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 5a7751a..985aa8a 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(var.private_key)}" + private_key = data.local_file.github_actions # Type of connection type = "ssh" }