Terraform-provider-aws: Add ARN attribute for aws_instance

Created on 2 Aug 2018  ·  4Comments  ·  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I'd love to be able to directly access the ARN of an EC2 instance, for example for interpolation into an IAM policy.

New or Affected Resource(s)

Of note, the ARN is already exported for the db_instance resource and data resource.

Potential Terraform Configuration

resource "aws_instance" "main" {
  // ... etc. etc.
}

data "template_file" "iam_policy_template" {
  template = "$(file("my-policy.json")}"

  vars {
    instance_arn = "${aws_instance.main.arn}"
  }
}
enhancement good first issue servicec2

All 4 comments

That's probably not the only resource with missing ARN, probably would be a good idea to go over them and check.

The new arn attribute for the resource and data source has been merged and will release with version 1.31.0 of the AWS provider later this week. 👍

This has been released in version 1.31.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings