clippable/aws/infra/ec2.tf
shockrah 9775ae9cb7 + Simple example infrastructure built with Terraform
This should have literally everything you need to
run a single command and get all infra components
live and ready for app deployment.
2021-10-19 19:57:50 -07:00

36 lines
837 B
HCL

# This here module takes care of setting up the ec2 instances that our
# containers will bind to later on
variable "aws_key" {}
variable "aws_secret" {}
variable "aws_region" {}
variable "ami_id" {}
variable "instance_type" {}
variable "ssh_key_name" {}
variable "public_key_path" {}
variable "availability_zone" {}
provider "aws" {
access_key = var.aws_key
secret_key = var.aws_secret
region = var.aws_region
max_retries = 1
}
resource "aws_key_pair" "sshkey" {
key_name = var.ssh_key_name
public_key = file(var.public_key_path)
}
resource "aws_instance" "app_instance" {
ami = var.ami_id
instance_type = var.instance_type
key_name = var.ssh_key_name
security_groups = [ aws_security_group.app_security_group.id ]
subnet_id = aws_subnet.app_public_subnet.id
tags = {
Name = "Clippable App Instance"
}
}