Skip to content

Event source name is too long for IAM roleΒ #183

@sophie-warner-annalise-ai

Description

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

  • βœ‹ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]:

4.1.0

  • Terraform version:

OpenTofu v1.10.2
on darwin_arm64

  • Provider version(s):

+ provider registry.opentofu.org/grafana/grafana v4.5.3
+ provider registry.opentofu.org/hashicorp/aws v6.10.0

Reproduction Code [Required]

Steps to reproduce the behaviour:

If you use events from a partner event the event sources will have a super long name like aws.partner/auth0.com/####/auth0.logs. If you use an event source the bus must have a matching name. This tries to create an IAM role who's name is too long.

module "partner_events" {
  for_each = var.partner_events_to_ingest
  source = "terraform-aws-modules/eventbridge/aws"
  version = "~> 4.1"

  bus_name = data.aws_cloudwatch_event_source.partner_events[each.key].name
  event_source_name  = data.aws_cloudwatch_event_source.partner_events[each.key].name

  rules = {
    orders = {
      description   = "Forward data from ${each.key} to Grafana"
      event_pattern = jsonencode({ "source": [{ "prefix": "aws.partner/${each.key}.com" }] })
      enabled       = true
    }
  }

  targets = {
    orders = [
      {
        name            = "log-orders-to-cloudwatch"
        arn             = aws_cloudwatch_log_group.partner_events[each.key].arn
      },
    ]
  }
}

Expected behavior

Create an IAM role with a truncated name

Actual behavior

  β•·
  β”‚ Error: expected length of name to be in the range (1 - 64), got aws.partner/auth0.com/######/auth0.logs
  β”‚
  β”‚   with module.partner_events["auth0"].aws_iam_role.eventbridge[0],
  β”‚   on .terraform/modules/partner_events/iam.tf line 34, in resource "aws_iam_role" "eventbridge":
  β”‚   34:   name                  = local.role_name
  β”‚
  β•΅

Work around

Manually specify role_name.

Terminal Output Screenshot(s)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions