Skip to content

Commit

Permalink
separate files, var fix for ecs task
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerthome committed Oct 3, 2024
1 parent 47674bb commit c2f4670
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 56 deletions.
12 changes: 12 additions & 0 deletions terraform-incubator/home-unite-us/dev/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
backend "s3" {
region = "us-west-2"
key = "incubator/home-unite-us/dev.tfstate"
bucket = "hlfa-incubator-terragrunt"
}
}
2 changes: 2 additions & 0 deletions terraform-incubator/home-unite-us/dev/dev.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
listener_arn = "arn:aws:elasticloadbalancing:us-west-2:035866691871:listener/app/incubator-prod-lb/7451adf77133ef36/390a225766a4daf3"

17 changes: 17 additions & 0 deletions terraform-incubator/home-unite-us/dev/ecr.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

resource "aws_ecr_repository" "this" {
image_tag_mutability = "MUTABLE"
name = local.app_name
tags = {
"Organization" = "Hack for LA"
}

image_scanning_configuration {
scan_on_push = true
}
}

data "aws_lb_listener" "listener" {
arn = local.listener_arn
}

14 changes: 14 additions & 0 deletions terraform-incubator/home-unite-us/dev/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
locals {
root_host_name = "homeunite.us"
app_name = "homeuniteus"
listener_arn = "arn:aws:elasticloadbalancing:us-west-2:035866691871:listener/app/incubator-prod-lb/7451adf77133ef36/390a225766a4daf3"
vpc_id = "vpc-0bec93a4d80243845"
path_pattens = ["/*"]
subdomains = [
"dev",
"qa",
"incubator"
]
host_names = [for subdomain in local.subdomains : "${subdomain}.${local.app_name}"]

}
56 changes: 0 additions & 56 deletions terraform-incubator/home-unite-us/dev/main.tf
Original file line number Diff line number Diff line change
@@ -1,63 +1,8 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
backend "s3" {
region = "us-west-2"
key = "incubator/home-unite-us/dev.tfstate"
bucket = "hlfa-incubator-terragrunt"
}
}

provider "aws" {
region = "us-west-2"
}

locals {
root_host_name = "homeunite.us"
app_name = "homeuniteus"
listener_arn = "arn:aws:elasticloadbalancing:us-west-2:035866691871:listener/app/incubator-prod-lb/7451adf77133ef36/390a225766a4daf3"
vpc_id = "vpc-0bec93a4d80243845"
path_pattens = ["/*"]
subdomains = [
"dev",
"qa",
"incubator"
]
host_names = [for subdomain in local.subdomains : "${subdomain}.${local.app_name}"]

}

resource "aws_route53_zone" "main" {
name = local.root_host_name
}

resource "aws_route53_record" "root_a_record" {
zone_id = aws_route53_zone.main.zone_id
name = local.root_host_name
type = "A"
ttl = 300
records = ["18.223.160.58"]
}

resource "aws_ecr_repository" "this" {
image_tag_mutability = "MUTABLE"
name = local.app_name
tags = {
"Organization" = "Hack for LA"
}

image_scanning_configuration {
scan_on_push = true
}
}

data "aws_lb_listener" "listener" {
arn = local.listener_arn
}


resource "aws_lb_target_group" "this" {
target_type = "ip"
Expand Down Expand Up @@ -147,7 +92,6 @@ resource "aws_ecs_task_definition" "task" {
cpu = "256"
execution_role_arn = "arn:aws:iam::035866691871:role/incubator-prod-ecs-task-role"
family = "homeuniteus"
id = "homeuniteus"
memory = "512"
network_mode = "awsvpc"
requires_compatibilities = [
Expand Down
12 changes: 12 additions & 0 deletions terraform-incubator/home-unite-us/dev/network.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

resource "aws_route53_zone" "main" {
name = local.root_host_name
}

resource "aws_route53_record" "root_a_record" {
zone_id = aws_route53_zone.main.zone_id
name = local.root_host_name
type = "A"
ttl = 300
records = ["18.223.160.58"]
}

0 comments on commit c2f4670

Please sign in to comment.