hardfinhq / terraform-aws-tailscale-subnet-router

Terraform module for Tailscale subnet router in AWS ECS Fargate
https://registry.terraform.io/modules/hardfinhq/tailscale-subnet-router/aws
Apache License 2.0
30 stars 9 forks source link

Fix: Specify ECS Task Definition to run ARM64 arch to avoid failures #6

Closed smkjason closed 1 year ago

smkjason commented 1 year ago

The tailscale image does not support X86 architecture. The default may be different for different AWS regions but in my case, it spins up the X86 architecture machine and causes the image to fail during execution. ARM64 arch is known to be more cost-efficient as well.

We can add the following block under ecs_task_definition to avoid this.

resource "aws_ecs_task_definition" "tailscale" {
  family                   = "${var.vpc}-tailscale"
  requires_compatibilities = ["FARGATE"]
  network_mode             = "awsvpc"
  cpu                      = "256" # 0.25 vCPU (256/1024)
  ...

  runtime_platform {
    operating_system_family = "LINUX"
    cpu_architecture        = "ARM64"
  }
}
dhermes commented 1 year ago

SGTM, do you want to send a PR?

smkjason commented 1 year ago

Yea sure, I'll create some PRs sometime soon.

cablespaghetti commented 1 year ago

The tailscale image does not support X86 architecture. The default may be different for different AWS regions but in my case, it spins up the X86 architecture machine and causes the image to fail during execution. ARM64 arch is known to be more cost-efficient as well.

We can add the following block under ecs_task_definition to avoid this.

resource "aws_ecs_task_definition" "tailscale" {
  family                   = "${var.vpc}-tailscale"
  requires_compatibilities = ["FARGATE"]
  network_mode             = "awsvpc"
  cpu                      = "256" # 0.25 vCPU (256/1024)
  ...

  runtime_platform {
    operating_system_family = "LINUX"
    cpu_architecture        = "ARM64"
  }
}

When you say the image does not support X86, do you mean that the image you have pushed to your ECR is an ARM64 image? The one on docker hub does seem to support a number of different architectures.