Moving fargate things to their own folder
This commit is contained in:
parent
caf09a63cb
commit
3029fbb3f6
24
infra/fargate/Makefile
Normal file
24
infra/fargate/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
plan=out.plan
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
$(plan): *.tf
|
||||
source ../secrets/set-env.sh && terraform plan -input=false -out $(plan)
|
||||
|
||||
push: build
|
||||
source ../secrets/set-env.sh && terraform apply $(plan)
|
||||
|
||||
refresh:
|
||||
source ../secrets/set-env.sh && terraform apply -refresh-only
|
||||
|
||||
test:
|
||||
terraform validate
|
||||
|
||||
|
||||
rip:
|
||||
source ../secrets/set-env.sh && terraform destroy
|
||||
|
||||
clean:
|
||||
rm -f $(plan)
|
||||
|
||||
.PHONY: test build clean push rip
|
24
infra/fargate/backend.tf
Normal file
24
infra/fargate/backend.tf
Normal file
@ -0,0 +1,24 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
backend "s3" {
|
||||
bucket = "project-athens"
|
||||
key = "infra/fargate/state/build.tfstate"
|
||||
region = "us-west-1"
|
||||
encrypt = true
|
||||
}
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "4.13.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Base config for using AWS features w/ Terraform
|
||||
provider "aws" {
|
||||
access_key = var.aws_key
|
||||
secret_key = var.aws_secret
|
||||
region = var.aws_region
|
||||
max_retries = 1
|
||||
}
|
||||
|
12
infra/fargate/data.tf
Normal file
12
infra/fargate/data.tf
Normal file
@ -0,0 +1,12 @@
|
||||
data "aws_vpc" "athens" {
|
||||
id = var.vpc_id
|
||||
}
|
||||
|
||||
data "aws_subnet" "delphi" {
|
||||
id = "subnet-0a1943f26e4338cf6"
|
||||
}
|
||||
|
||||
data "aws_subnet" "crete" {
|
||||
id = "subnet-09302319a6678643f"
|
||||
}
|
||||
|
13
infra/fargate/local.tf
Normal file
13
infra/fargate/local.tf
Normal file
@ -0,0 +1,13 @@
|
||||
locals {
|
||||
# ECR
|
||||
repos = [
|
||||
"reverse-proxy",
|
||||
]
|
||||
buckets = [
|
||||
"shockrah.xyz",
|
||||
"resume.shockrah.xyz"
|
||||
]
|
||||
nginx_name = "${var.athens_prefix}-nginx-static-content"
|
||||
nginx_hp_check_interval = 300
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ resource "aws_ecs_service" "beta_reverse_proxy" {
|
||||
desired_count = 1
|
||||
launch_type = "FARGATE"
|
||||
load_balancer {
|
||||
target_group_arn = aws_lb_target_group.nginx.arn
|
||||
target_group_arn = var.lb_target_group
|
||||
container_name = local.nginx_name
|
||||
container_port = var.nginx_port
|
||||
}
|
||||
@ -60,7 +60,4 @@ resource "aws_ecs_service" "beta_reverse_proxy" {
|
||||
var.sg.base_ecs,
|
||||
]
|
||||
}
|
||||
depends_on = [
|
||||
aws_lb_target_group.nginx
|
||||
]
|
||||
}
|
53
infra/fargate/variables.tf
Normal file
53
infra/fargate/variables.tf
Normal file
@ -0,0 +1,53 @@
|
||||
# All variables that are used in various places go here
|
||||
|
||||
######################### General provider specific values
|
||||
|
||||
variable "aws_key" {
|
||||
description = "Access Key for AWS operations"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "aws_secret" {
|
||||
description = "Secret Key for AWS operations"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "aws_region" {
|
||||
description = "Region where the VPC is located"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "vpc_id" {
|
||||
description = "Project Athens VPC ID"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "athens_prefix" {
|
||||
description = "Prefix for all things in alpha cluster"
|
||||
type = string
|
||||
}
|
||||
|
||||
######################### Nginx reverse proxy vars
|
||||
|
||||
variable "nginx_port" {
|
||||
description = "Port for shockrah.xyz"
|
||||
type = number
|
||||
}
|
||||
|
||||
######################### Nginx reverse proxy vars
|
||||
|
||||
variable "sg" {
|
||||
type = object({
|
||||
base_ecs = string
|
||||
ecs_web_ingress = string
|
||||
lb_health_check = string
|
||||
})
|
||||
}
|
||||
|
||||
variable "lb_target_group" {
|
||||
type = string
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user