
This should have literally everything you need to run a single command and get all infra components live and ready for app deployment.
36 lines
837 B
HCL
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"
|
|
}
|
|
}
|