Alpha configuration which still wont register

This commit is contained in:
shockrah 2022-12-16 22:51:05 -08:00
parent c4e169efee
commit ae61177661

View File

@ -2,60 +2,7 @@
# Essentially it is a cluster with services that we
# choose to expose to the internet in one form or another
# Logging Configuration for services inside the cluster
#######################################################
locals {
subnet = "subnet-09302319a6678643f"
}
# Alpha Cloudwatch logging configuration
########################################
resource "aws_cloudwatch_log_group" "alpha" {
name = "${var.athens_prefix}-alpha-log"
retention_in_days = 7
}
# Alpha logging role
#####################
resource "aws_iam_role" "alpha_iam_role" {
name = "${var.athens_prefix}-alpha-iam-role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Principal = {
Service = [ "ecs-tasks.amazonaws.com" ]
}
Effect = "Allow"
}
]
})
}
resource "aws_iam_policy" "alpha_iam_policy" {
name = "${var.athens_prefix}-alpha-iam-policy"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:DescribeLogStreams",
"logs:PutLogEvents",
]
"Resource" = "*"
}
]
})
}
resource "aws_iam_role_policy_attachment" "alpha_logs" {
role = aws_iam_role.alpha_iam_role.name
policy_arn = aws_iam_policy.alpha_iam_policy.arn
}
# Alpha cluster definition
@ -73,8 +20,9 @@ resource "aws_ecs_cluster" "alpha" {
}
# Lewdlad Service Definition
############################
# Lewdlad Task Definition
# This is what the service will launch to actually provide the lewdlad service
##############################################################################
resource "aws_ecs_task_definition" "sample" {
family = "${var.athens_prefix}-sample"
@ -88,14 +36,14 @@ resource "aws_ecs_task_definition" "sample" {
container_definitions = jsonencode([
{
name = "${var.athens_prefix}-sample-container"
image = "nginxdemos/nginx-hello:latest"
cpu = 128
memory = 256
image = "nginx"
cpu = 256
memory = 512
essential = true
portMappings = [
{
containerPort = 8080
hostPort = 8080
containerPort = 80
hostPort = 80
}
]
logConfiguration = {
@ -124,15 +72,18 @@ resource "aws_ecs_service" "sample" {
load_balancer {
target_group_arn = aws_lb_target_group.alpha_cluster.arn
container_name = "${var.athens_prefix}-sample-container"
container_port = 8080
container_port = 80
}
network_configuration {
assign_public_ip = true
subnets = [ local.subnet ]
subnets = [
aws_subnet.delphi.id,
aws_subnet.crete_subnet.id
]
security_groups = [
aws_security_group.ecs_web_ingress.id,
aws_security_group.base_ecs.id
]
]
}
}