Alpha configuration which still wont register
This commit is contained in:
parent
c4e169efee
commit
ae61177661
@ -2,60 +2,7 @@
|
|||||||
# Essentially it is a cluster with services that we
|
# Essentially it is a cluster with services that we
|
||||||
# choose to expose to the internet in one form or another
|
# 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
|
# 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" {
|
resource "aws_ecs_task_definition" "sample" {
|
||||||
family = "${var.athens_prefix}-sample"
|
family = "${var.athens_prefix}-sample"
|
||||||
|
|
||||||
@ -88,14 +36,14 @@ resource "aws_ecs_task_definition" "sample" {
|
|||||||
container_definitions = jsonencode([
|
container_definitions = jsonencode([
|
||||||
{
|
{
|
||||||
name = "${var.athens_prefix}-sample-container"
|
name = "${var.athens_prefix}-sample-container"
|
||||||
image = "nginxdemos/nginx-hello:latest"
|
image = "nginx"
|
||||||
cpu = 128
|
cpu = 256
|
||||||
memory = 256
|
memory = 512
|
||||||
essential = true
|
essential = true
|
||||||
portMappings = [
|
portMappings = [
|
||||||
{
|
{
|
||||||
containerPort = 8080
|
containerPort = 80
|
||||||
hostPort = 8080
|
hostPort = 80
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
logConfiguration = {
|
logConfiguration = {
|
||||||
@ -124,15 +72,18 @@ resource "aws_ecs_service" "sample" {
|
|||||||
load_balancer {
|
load_balancer {
|
||||||
target_group_arn = aws_lb_target_group.alpha_cluster.arn
|
target_group_arn = aws_lb_target_group.alpha_cluster.arn
|
||||||
container_name = "${var.athens_prefix}-sample-container"
|
container_name = "${var.athens_prefix}-sample-container"
|
||||||
container_port = 8080
|
container_port = 80
|
||||||
}
|
}
|
||||||
|
|
||||||
network_configuration {
|
network_configuration {
|
||||||
assign_public_ip = true
|
assign_public_ip = true
|
||||||
subnets = [ local.subnet ]
|
subnets = [
|
||||||
|
aws_subnet.delphi.id,
|
||||||
|
aws_subnet.crete_subnet.id
|
||||||
|
]
|
||||||
security_groups = [
|
security_groups = [
|
||||||
aws_security_group.ecs_web_ingress.id,
|
aws_security_group.ecs_web_ingress.id,
|
||||||
aws_security_group.base_ecs.id
|
aws_security_group.base_ecs.id
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user