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

aws_iam_instance_profile does not populate unique_id attribute #12430

Closed
thomasvandoren opened this issue Mar 3, 2017 · 1 comment · Fixed by #12449
Closed

aws_iam_instance_profile does not populate unique_id attribute #12430

thomasvandoren opened this issue Mar 3, 2017 · 1 comment · Fixed by #12449

Comments

@thomasvandoren
Copy link

thomasvandoren commented Mar 3, 2017

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Terraform v0.8.8

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_iam_instance_profile

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

variable "name_prefix" {
  type = "string"
  default = "NO_PREFIX_SET"
}

variable "policy_arn" {
  type = "string"
  default = "NO_POLICY_ARN_SET"
}

data "aws_iam_policy_document" "ec2_assume_role_policy" {
  statement {
    effect = "Allow"
    principals {
      type = "Service"
      identifiers = [
        "ec2.amazonaws.com"
      ]
    }
    actions = [
      "sts:AssumeRole"
    ]
  }
}

resource "aws_iam_role" "ec2_role" {
  name = "${var.name_prefix}_ec2_role"
  assume_role_policy = "${data.aws_iam_policy_document.ec2_assume_role_policy.json}"
}

resource "aws_iam_role_policy_attachment" "ec2_policy" {
  role = "${aws_iam_role.ec2_role.name}"
  policy_arn = "${var.policy_arn}"
}

resource "aws_iam_instance_profile" "ec2_profile" {
  name = "${var.name_prefix}_ec2_instance_profile"
  path = "/"
  roles = ["${aws_iam_role.ec2_role.name}"]
}

output "instance_profile_uid" {
  value = "${aws_iam_instance_profile.ec2_profile.unique_id}"
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Expected Behavior

What should have happened?

The instance_profile_uid output should have the unique id for the instance profile.

Actual Behavior

What actually happened?

There is no unique_id defined for the instance profile. Even the state does not include a unique_id attribute:

 tf state show <redacted>.aws_iam_instance_profile.ec2_profile               
id               = <redacted>_ec2_instance_profile
arn              = arn:aws:iam::<redacted>:instance-profile/<redacted>_ec2_instance_profile
name             = <redacted>_ec2_instance_profile
path             = /
roles.#          = 1
roles.4291128237 = <redacted>_ec2_role

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan -out myplan
  2. terraform apply myplan

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

no

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

none I could find

@ghost
Copy link

ghost commented Apr 16, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants