4
0
Fork 0

changed to local file lookup

This commit is contained in:
uk-bolly 2022-07-27 11:30:09 +01:00 committed by GitHub
parent df2d812e6a
commit b3cf41af6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,11 @@ provider "aws" {
region = var.aws_region 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 // Create a security group with access to port 22 and port 80 open to serve HTTP traffic
data "aws_vpc" "default" { data "aws_vpc" "default" {
@ -66,7 +71,7 @@ resource "aws_instance" "testing_vm" {
# The default username for our AMI # The default username for our AMI
user = var.ami_username user = var.ami_username
# Private key for connection # Private key for connection
private_key = file(".ssh/github_actions.pem") private_key = data.local_file.github_actions.content
# Type of connection # Type of connection
type = "ssh" type = "ssh"
} }