Skip to content

With 18.x: Unable to read iam_role_name from the new fargate_profiles sub-module #1777

@nickjj

Description

@nickjj

Description

I read through the 18.x upgrade guide and it mentioned fargate_iam_role_name has been removed. Now there's a new fargate-profiles sub-module which has its own iam_role_name output, however I'm unable to access it in a similar way to how you could back in 17.x.

Versions

  • Terraform: 1.1.3
  • Module: EKS - 18.0.6

Reproduction

Code Snippet to Reproduce

resource "aws_iam_role_policy_attachment" "fluent_bit_eks_fargate" {
  # The old way that works with v17.x:
  # role       = module.eks.fargate_iam_role_name
  # ----------------------------------

  role       = module.eks.fargate_profiles.iam_role_name
  policy_arn = aws_iam_policy.fluent_bit_eks_fargate.arn

  depends_on = [module.eks]
}

Expected behavior

Everything would work and the role name would be properly set.

Actual behavior

It throws this error:

│   on fluent_bit.tf line 28, in resource "aws_iam_role_policy_attachment" "fluent_bit_eks_fargate":
│   28:   role       = module.eks.fargate_profiles.iam_role_name
│     ├────────────────
│     │ module.eks.fargate_profiles is object with 4 attributes
│
│ This object does not have an attribute named "iam_role_name".

This output is listed as available in:

output "iam_role_name" {
description = "The name of the IAM role"
value = try(aws_iam_role.this[0].name, "")
}

I also tried using fargate_profile (no "s" at the end) but then it says the module isn't found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions