Skip to content

Updated tag specification for services managed by terraform #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 15 additions & 30 deletions terraform-unity-ui/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ resource "aws_lb" "main" {
subnets = local.public_subnet_ids
security_groups = [aws_security_group.ecs_sg.id]
enable_deletion_protection = false
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)
}

resource "aws_alb_target_group" "app" {
Expand All @@ -33,32 +28,22 @@ resource "aws_alb_target_group" "app" {
timeout = 5
unhealthy_threshold = 2
}
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)
}

resource "aws_alb_listener" "front_end" {
load_balancer_arn = aws_lb.main.id
port = 8080
protocol = "HTTP"
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)

default_action {
type = "forward"
Expand Down
45 changes: 15 additions & 30 deletions terraform-unity-ui/ecs.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
resource "aws_ecs_cluster" "main" {
name = "${var.project}-${var.venue}-dashboard-cluster"
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)
}

resource "aws_ecs_task_definition" "app" {
Expand Down Expand Up @@ -79,16 +74,11 @@ resource "aws_ecs_task_definition" "app" {
}
]
)
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)
}

resource "aws_ecs_service" "main" {
Expand All @@ -97,16 +87,11 @@ resource "aws_ecs_service" "main" {
task_definition = aws_ecs_task_definition.app.arn
desired_count = var.app_count
launch_type = "FARGATE"
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)

network_configuration {
security_groups = [aws_security_group.ecs_sg.id]
Expand Down
15 changes: 5 additions & 10 deletions terraform-unity-ui/iam.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
resource "aws_iam_role" "ecs_task_execution_role" {
name = "${var.project}-${var.venue}-dashboard-ecs_task_execution_role"
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)

assume_role_policy = jsonencode({
Version = "2012-10-17",
Expand Down
15 changes: 5 additions & 10 deletions terraform-unity-ui/security.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ resource "aws_security_group" "ecs_sg" {
name = "${var.project}-${var.venue}-dashboard-ecs-sg"
description = "Security group for the dashboard ECS Service"
vpc_id = data.aws_ssm_parameter.vpc_id.value
tags = {
Venue = "dev",
ServiceArea = "uiux",
CapVersion = "0.8.0"
Component = "Navbar",
Proj = "Unity",
CreatedBy = "uiux",
Env = "dev",
Stack = "UI"
}
tags = merge(
var.tags,
var.default_tags,
{},
)

// Inbound rules
// Example: Allow HTTP and HTTPS
Expand Down
15 changes: 15 additions & 0 deletions terraform-unity-ui/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ variable "tags" {
type = map(string)
}

variable "default_tags" {
description = ""
type = map(string)
default = {
Venue = "dev"
ServiceArea = "uiux"
CapVersion = "0.8.0"
Component = "Navbar"
Proj = "Unity"
CreatedBy = "uiux"
Env = "dev"
Stack = "UI"
}
}

// Injected by Marketplace
variable "venue" {
description = "The MCP venue in which the cluster will be deployed (dev, test, prod)"
Expand Down