From 3dbb3756b982cada0bba572fa8283544364ec2d3 Mon Sep 17 00:00:00 2001 From: Andy Miles Date: Thu, 19 Dec 2024 12:04:35 -0800 Subject: [PATCH] refact with copilot --- terraform/main.tf | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/terraform/main.tf b/terraform/main.tf index 205c51a..881e7bf 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,5 +1,17 @@ provider "aws" { - region = "us-west-2" + region = var.aws_region +} + +variable "aws_region" { + description = "The AWS region to deploy resources in" + type = string + default = "us-west-2" +} + +variable "public_key_path" { + description = "Path to the public key file" + type = string + default = "id_rsa.pub" } data "aws_security_groups" "all" { @@ -43,10 +55,9 @@ resource "random_id" "suffix" { byte_length = 4 } - resource "aws_key_pair" "deployer" { key_name = "deployer-key-${random_id.suffix.hex}" - public_key = file("id_rsa.pub") + public_key = file(var.public_key_path) } resource "aws_security_group" "allow_ssh" {