Skip to content
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

Allow passing in role_arn #12

Closed
icco opened this issue Jun 20, 2021 · 4 comments · Fixed by #13 or #14
Closed

Allow passing in role_arn #12

icco opened this issue Jun 20, 2021 · 4 comments · Fixed by #13 or #14

Comments

@icco
Copy link
Contributor

icco commented Jun 20, 2021

Description

If using an ecs_target, and create_bus is false, you can't generate a valid terraform config, because ecs_target requires a role_arn but one isn't submitted when create_bus is false.

Reproduction

module "eb" {
  source = "terraform-aws-modules/eventbridge/aws"

  // Can't use a custom bus with schedules
  create_bus = false

  rules = {
    test   = {
      enabled             = true
      schedule_expression = var.schedule
    }
  }

  attach_ecs_policy = true
  ecs_target_arns   = [aws_ecs_task_definition.curl.arn]

  targets = {
    test => [
      {
        name            = "test"
        arn             = var.ecs_cluster,
        attach_role_arn = true

        ecs_target = {
          launch_type         = "FARGATE"
          task_count          = 1
          task_definition_arn = aws_ecs_task_definition.curl.arn

          network_configuration = {
            assign_public_ip = true
            subnets          = var.public_subnets
            security_groups  = var.vpc_security_groups
          }
      }
    ]
  }
}

resource "aws_ecs_task_definition" "curl" {
  family       = "curl"
  network_mode = "awsvpc"
  cpu          = "512"
  memory       = "1024"

  requires_compatibilities = ["FARGATE"]

  container_definitions = jsonencode([
    {
      name      = "curl"
      image     = "curlimages/curl:latest"
      cpu       = 10
      memory    = 256
      essential = true
      command   = ["-s", "-v", "-L", var.target]
    }
  ])
}
@icco
Copy link
Contributor Author

icco commented Jun 21, 2021

Oh, and example of the error you'll see: Error: Creating CloudWatch Events Target failed: ValidationException: RoleArn is required for target arn:aws:ecs:us-east-1:xxxxxxxx:cluster/development. status code: 400, request id: xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx

@antonbabenko
Copy link
Member

Reopening until #14 is fixed.

@kenanbiel
Copy link

When do you think will this be fixed? :)

Copy link

github-actions bot commented Mar 9, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants