diff --git a/main.tf b/main.tf index eb41e30..492aa6b 100644 --- a/main.tf +++ b/main.tf @@ -31,6 +31,41 @@ resource "aws_ecs_cluster" "github-runner" { data "aws_region" "current" {} +data "aws_region" "current" {} + +resource "aws_vpc_endpoint" "ecr" { + for_each = var.create_vpc_endpoint ? toset([ + "com.amazonaws.${data.aws_region.current.name}.ecr.api", + "com.amazonaws.${data.aws_region.current.name}.ecr.dkr" + ]) : toset([]) + vpc_id = var.vpc_id + service_name = each.value + vpc_endpoint_type = "Interface" + + security_group_ids = var.security_groups + private_dns_enabled = true +} + +resource "aws_ecs_cluster_capacity_providers" "fargate" { + cluster_name = aws_ecs_cluster.github-runner.name + + capacity_providers = ["FARGATE"] + + default_capacity_provider_strategy { + base = 1 + weight = 100 + capacity_provider = "FARGATE" + } +} + +locals { + labels = [ + "self-hosted", + "ecs", + "github-runner" + ] +} + module "github-runner" { for_each = toset([for repo in local.all_repos : repo]) source = "HappyPathway/github-runner/ecs"