Add SSH_PUBLIC_KEY variable

This commit is contained in:
Ryan Malloy 2024-11-10 22:54:59 -07:00
parent 92d1af3fb7
commit b3ab3e7c33
3 changed files with 5 additions and 33 deletions

18
main.tf
View file

@ -1,31 +1,15 @@
provider "aws" {
region = var.aws_region
access_key = var.aws_access_key
secret_key = var.aws_secret_key
}
resource "aws_vpc" "main_vpc" {
cidr_block = var.vpc_cidr
tags = {
Name = "main-vpc"
}
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.main_vpc.id
tags = {
Name = "main-igw"
}
}
resource "aws_subnet" "public_subnet" {
vpc_id = aws_vpc.main_vpc.id
cidr_block = var.public_cidr
availability_zone = "${var.aws_region}a"
map_public_ip_on_launch = true
tags = {
Name = "public-subnet"
}
}
# Create a route table with a route to the internet through the Internet Gateway
@ -43,7 +27,6 @@ resource "aws_route_table_association" "public_rt_association" {
route_table_id = aws_route_table.public_rt.id
}
resource "tls_private_key" "ssh_key" {
algorithm = "RSA"
rsa_bits = 4096
@ -97,6 +80,7 @@ resource "aws_security_group" "allow_ssh_http_https" {
}
}
data "aws_ami" "latest_ecs" {
most_recent = true
owners = ["591542846629"] # AWS