added local file option

Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
Mark Bolwell 2022-07-26 17:54:28 +01:00
parent 5c0bc4137a
commit 0c6feb1b67
No known key found for this signature in database
GPG key ID: F734FDFC154B83FB

View file

@ -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"
}