Skip to content

Commit

Permalink
Push pre-commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth-singh1 authored and github-actions[bot] committed Nov 27, 2024
1 parent f3cfff7 commit 64380cc
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 74 deletions.
2 changes: 1 addition & 1 deletion data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "aws_security_group" "proxy" {
id = var.proxy_security_group
}
}
2 changes: 1 addition & 1 deletion example/container/container_definition.json.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
}
}
}
]
]
2 changes: 1 addition & 1 deletion example/container/execution_role.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"Resource": "*"
}
]
}
}
6 changes: 3 additions & 3 deletions example/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ resource "aws_iam_role_policy" "policies" {
role = module.aws_service.task_role_id

policy = templatefile("${path.module}/container/task_role/${each.value}", {
aws_region = var.region
aws_account = var.aws_account
environment = var.environment
aws_region = var.region
aws_account = var.aws_account
environment = var.environment
})

depends_on = [
Expand Down
4 changes: 2 additions & 2 deletions example/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
locals {
cluster_name_full = "${var.ecs.cluster_name}-${var.environment}"
service_name_full = "${var.ecs.service_name}-${var.environment}"
cluster_name_full = "${var.ecs.cluster_name}-${var.environment}"
service_name_full = "${var.ecs.service_name}-${var.environment}"
}
1 change: 0 additions & 1 deletion example/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ output "cluster_id" {
description = "ECS Cluster ID"
value = module.ecs.cluster_id
}

30 changes: 15 additions & 15 deletions modules/ecs-fargate/cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ resource "aws_cloudwatch_log_group" "proxy" {
name = "/aws/ecs/${var.ecs.cluster_name}/${var.ecs.service_name}/${var.environment}"
retention_in_days = 90
tags = {
Name = "/aws/ecs/${var.ecs.cluster_name}/${var.ecs.service_name}/${var.environment}",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "/aws/ecs/${var.ecs.cluster_name}/${var.ecs.service_name}/${var.environment}",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}


Expand All @@ -25,11 +25,11 @@ resource "aws_cloudwatch_metric_alarm" "cpu_high" {

alarm_actions = [aws_appautoscaling_policy.scale_up.arn]
tags = {
Name = "${local.service_name_full}-cpu-high-alarm",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${local.service_name_full}-cpu-high-alarm",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}

// Autoscaling - Alarm CPU Low
Expand All @@ -47,9 +47,9 @@ resource "aws_cloudwatch_metric_alarm" "cpu_low" {

alarm_actions = [aws_appautoscaling_policy.scale_down.arn]
tags = {
Name = "${local.service_name_full}-cpu-low-alarm",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${local.service_name_full}-cpu-low-alarm",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}
20 changes: 10 additions & 10 deletions modules/ecs-fargate/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ resource "aws_iam_role" "task_role" {
name = "${local.service_name_full}-task-role"
assume_role_policy = data.aws_iam_policy_document.document.json
tags = {
Name = "${local.service_name_full}-task-role",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${local.service_name_full}-task-role",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}

# The ECS Task Execution role IAM permissions
resource "aws_iam_role" "execution_role" {
name = "${local.service_name_full}-execution-role"
assume_role_policy = data.aws_iam_policy_document.document.json
tags = {
Name = "${local.service_name_full}-execution-role",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${local.service_name_full}-execution-role",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}

resource "aws_iam_role_policy" "execution_role" {
Expand Down
2 changes: 1 addition & 1 deletion modules/ecs-fargate/json/container_definition.json.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
}
}
}
]
]
2 changes: 1 addition & 1 deletion modules/ecs-fargate/json/execution_role.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"Resource": "*"
}
]
}
}
18 changes: 9 additions & 9 deletions modules/ecs-fargate/lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ resource "aws_lb_target_group" "tg" {
}
}
tags = {
Name = "${local.service_name_full}-tg",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${local.service_name_full}-tg",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}

resource "aws_lb_listener" "listener" {
Expand All @@ -33,8 +33,8 @@ resource "aws_lb_listener" "listener" {
target_group_arn = aws_lb_target_group.tg.arn
}
tags = {
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}
6 changes: 3 additions & 3 deletions modules/ecs-fargate/locals.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
service_name_full = "${var.ecs.service_name}-${var.environment}"
cluster_name_full = "${var.ecs.cluster_name}-${var.environment}"
service_name_full = "${var.ecs.service_name}-${var.environment}"
cluster_name_full = "${var.ecs.cluster_name}-${var.environment}"

region_code = (var.aws_region == "us-west-1") ? "uw1" : "ue1"

task = defaults(var.task, {
Expand Down
20 changes: 10 additions & 10 deletions modules/ecs-fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ resource "aws_ecs_service" "service" {
security_groups = [aws_security_group.ecs.id]
}
tags = {
Name = "${var.ecs.service_name}-${var.environment}",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${var.ecs.service_name}-${var.environment}",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
propagate_tags = "TASK_DEFINITION"
}

Expand All @@ -57,9 +57,9 @@ resource "aws_ecs_task_definition" "definition" {
})

tags = {
Name = "${var.ecs.service_name}-${var.environment}-task-definition",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
Name = "${var.ecs.service_name}-${var.environment}-task-definition",
Environment = "${var.environment}",
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}"
}
}
24 changes: 12 additions & 12 deletions modules/ecs-fargate/sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ resource "aws_security_group" "alb" {
}

tags = {
Name = "${local.service_name_full}-alb",
Environment = var.environment,
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}",
Description = "Allow HTTP traffic to the application proxy"
owner = "devops"
Name = "${local.service_name_full}-alb",
Environment = var.environment,
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}",
Description = "Allow HTTP traffic to the application proxy"
owner = "devops"
}
}

Expand All @@ -51,11 +51,11 @@ resource "aws_security_group" "ecs" {
}

tags = {
Name = "${local.service_name_full}-ecs",
Environment = var.environment,
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}",
Description = "Allow traffic from the ALB into the Docker containers."
owner = "devops"
Name = "${local.service_name_full}-ecs",
Environment = var.environment,
Project = "${var.project}",
Service = "${var.ecs.service_name_tag}",
Description = "Allow traffic from the ALB into the Docker containers."
owner = "devops"
}
}
2 changes: 1 addition & 1 deletion modules/ecs-fargate/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variable "project" {
variable "proxy_security_group" {
type = string
description = "The associated SG of the Dopple Proxy"
default = none
default = none
}

# ECS-specific variables
Expand Down
2 changes: 1 addition & 1 deletion modules/ecs-fargate/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ terraform {
version = ">= 4.0, < 6.0"
}
}
}
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variable "project" {
variable "proxy_security_group" {
type = string
description = "The associated SG of the Proxy"
default = none
default = none
}

# ECS-specific variables
Expand Down
2 changes: 1 addition & 1 deletion version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ terraform {
version = ">= 4.0, < 6.0"
}
}
}
}

0 comments on commit 64380cc

Please sign in to comment.