Skip to content

Commit

Permalink
Explicitly deploy switch to a unique instance (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie authored Sep 7, 2023
1 parent 397663a commit 497a34b
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
terraform 1.5.5
terraform 1.5.6
32 changes: 16 additions & 16 deletions infrastructure/core/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion infrastructure/modules/somleng_switch/client_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module client_gateway_container_instances {
# EIP
resource "aws_eip" "client_gateway" {
count = var.assign_client_gateway_eips ? var.client_gateway_max_tasks : 0
vpc = true
domain = "vpc"

tags = {
Name = "${var.client_gateway_identifier} ${count.index + 1}"
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/modules/somleng_switch/media_proxy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module media_proxy_container_instances {

resource "aws_eip" "media_proxy" {
count = var.assign_media_proxy_eips ? var.media_proxy_max_tasks : 0
vpc = true
domain = "vpc"

tags = {
Name = "Media Proxy ${count.index + 1}"
Expand Down
12 changes: 5 additions & 7 deletions infrastructure/modules/somleng_switch/s3_mpeg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ locals {
s3_filter_suffix = ".wav"
}

resource "docker_registry_image" "s3_mpeg" {
resource "docker_image" "s3_mpeg" {
name = "${var.s3_mpeg_ecr_repository_url}:latest"

build {
context = abspath("${path.module}/../../../components/s3_mpeg")
}
}

lifecycle {
ignore_changes = [
build[0].context
]
}
resource "docker_registry_image" "s3_mpeg" {
name = docker_image.s3_mpeg.name
keep_remotely = true
}

resource "aws_iam_role" "s3_mpeg" {
Expand Down
12 changes: 5 additions & 7 deletions infrastructure/modules/somleng_switch/services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ locals {

# Docker image

resource "docker_registry_image" "services" {
resource "docker_image" "services" {
name = "${var.services_ecr_repository_url}:latest"

build {
context = abspath("${path.module}/../../../components/services")
}
}

lifecycle {
ignore_changes = [
build[0].context
]
}
resource "docker_registry_image" "services" {
name = docker_image.services.name
keep_remotely = true
}

# SSM Parameters
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/modules/somleng_switch/switch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ resource "aws_ecs_service" "switch" {
weight = 1
}

placement_constraints {
type = "distinctInstance"
}

load_balancer {
target_group_arn = aws_lb_target_group.switch_http.arn
container_name = "nginx"
Expand Down
113 changes: 58 additions & 55 deletions infrastructure/production/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 497a34b

Please sign in to comment.