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_self_assume_role generates errors #293

Closed
LucaIcaro opened this issue Oct 21, 2022 · 2 comments
Closed

allow_self_assume_role generates errors #293

LucaIcaro opened this issue Oct 21, 2022 · 2 comments

Comments

@LucaIcaro
Copy link

LucaIcaro commented Oct 21, 2022

Description

I have an issue while creating a simple role with allow_self_assume_role.

Versions

  • Module version [Required]: 5.5.2

  • Terraform version:
    1.1.2

  • Provider version(s):

Terraform v1.1.2
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v4.36.0

Reproduction Code [Required]

Steps to reproduce the behavior:

provider "aws" {
  region     = "eu-west-2"
}

module "mytest" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-assumable-role"
  version = "~> 5.5"

  trusted_role_services = [
    "ec2.amazonaws.com",
  ]

  allow_self_assume_role = true

  create_role = true

  role_name         = "mytest"
  role_requires_mfa = false

  custom_role_policy_arns           = ["arn:aws:iam::aws:policy/PowerUserAccess", "arn:aws:iam::aws:policy/IAMFullAccess"]
  number_of_custom_role_policy_arns = 2
}

Expected behavior

terraform plan should return no errors

Actual behavior

╷
│ Error: Reference to undeclared local value
│ 
│   on .terraform/modules/mytest/modules/iam-assumable-role/main.tf line 26, in data "aws_iam_policy_document" "assume_role":
│   26:         values   = ["arn:${local.partition}:iam::${local.account_id}:role${var.role_path}${local.role_name_condition}"]
│ 
│ A local value with the name "partition" has not been declared.
╵
╷
│ Error: Reference to undeclared local value
│ 
│   on .terraform/modules/mytest/modules/iam-assumable-role/main.tf line 26, in data "aws_iam_policy_document" "assume_role":
│   26:         values   = ["arn:${local.partition}:iam::${local.account_id}:role${var.role_path}${local.role_name_condition}"]
│ 
│ A local value with the name "account_id" has not been declared.
@LucaIcaro
Copy link
Author

I just realised this is the same as #289 . Waiting for that fix.

@github-actions
Copy link

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 Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant