Skip to content

cloudwatch_log_group_name output returning incorrect value #1060

@paul-pop

Description

@paul-pop

I have issues

I'm submitting a...

  • bug report
  • feature request
  • support request - read the FAQ first!
  • kudos, thank you, warm fuzzy

What is the current behavior?

The cloudwatch_log_group_name output from the cluster is currently returned as a tuple.

If this is a bug, how to reproduce? Please include a code sample if relevant.

  1. Create a new cluster and set cluster_enabled_log_types = ["api"] so the CloudWatch group gets created.
  2. Wait for the cluster to be created and check the cloudwatch_log_group_name output is in the state
  3. Use the cloudwatch_log_group_name output in a different resource, like below:
resource "aws_cloudwatch_log_subscription_filter" "eks_cluster_logs_to_datadog" {
  name            = "${local.eks_cluster_name}-subscription"
  log_group_name  = module.eks_cluster.cloudwatch_log_group_name
  filter_pattern  = ""
  destination_arn = "lambda_arn_goes_here"
}
  1. Observe the error:
Error: Incorrect attribute value type

  on eks.tf line 151, in resource "aws_cloudwatch_log_subscription_filter" "eks_cluster_logs_to_lambda":
 151:   log_group_name  = module.eks.cloudwatch_log_group_name
    |----------------
    | module.eeks.cloudwatch_log_group_name is tuple with 1 element

Inappropriate value for attribute "log_group_name": string required.

What's the expected behavior?

The cloudwatch_log_group_name output should be a simple string so it can be reused correctly.

Are you able to fix this problem and submit a PR? Link here if you have already.

#1061

Environment details

  • Affected module version: 12.2.0
  • OS: macOS Catalina
  • Terraform version: v0.13.4

Any other relevant info

Temporary fix is to use module.eks_cluster.cloudwatch_log_group_name[0] instead but that's inconsistent with every other output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions