Sha256: f4e811cfcf08174b70b93ed2954e37dd18a0e7efd0601e696900ee6ba63fda9e

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

resource "aws_ecs_cluster" "aws_recon" {
  name               = "${var.aws_recon_base_name}-${random_id.cluster.hex}"
  capacity_providers = [local.ecs_task_provider]
}

resource "random_id" "cluster" {
  byte_length = 4
}

resource "aws_ecs_task_definition" "aws_recon_task" {
  family                   = "${var.aws_recon_base_name}-${random_id.cluster.hex}"
  task_role_arn            = aws_iam_role.aws_recon_role.arn
  execution_role_arn       = aws_iam_role.ecs_task_execution.arn
  requires_compatibilities = [local.ecs_task_provider]
  network_mode             = "awsvpc"
  cpu                      = 1024
  memory                   = 2048

  container_definitions = jsonencode([
    {
      name             = "${var.aws_recon_base_name}-${random_id.cluster.hex}"
      image            = "${var.aws_recon_container_name}:${var.aws_recon_container_version}"
      assign_public_ip = true
      entryPoint = [
        "aws_recon",
        "--verbose",
        "--s3-bucket",
        "${aws_s3_bucket.aws_recon.bucket}:${data.aws_region.current.name}",
        "--regions",
        join(",", var.aws_regions)
      ]
      logConfiguration = {
        logDriver = "awslogs"
        options = {
          awslogs-group         = aws_cloudwatch_log_group.aws_recon.name,
          awslogs-region        = data.aws_region.current.name,
          awslogs-stream-prefix = "ecs"
        }
      }
    }
  ])
}

resource "aws_cloudwatch_log_group" "aws_recon" {
  name              = "/ecs/${var.aws_recon_base_name}-${random_id.cluster.hex}"
  retention_in_days = var.retention_period
}

locals {
  ecs_task_provider = "FARGATE"
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws_recon-0.4.1 terraform/ecs.tf