Looking at the definition of a Resource here: https://www.terraform.io/docs/configuration/resources.html, you see examples like this:
resource "aws_iam_role" "example" {
name = "example"
# assume_role_policy is omitted for brevity in this example. See the
# documentation for aws_iam_role for a complete example.
assume_role_policy = "..."
}
The first example
in the top line is called the "name" and can be used to reference, eg aws_iam_role.example
. However, there is no discussion of 1) why there is also a key called "name" and why it is redundantly set to the same string "example". What is the purpose of this inner key name = example
, and what is the best practices here?
EDIT: this seems related: https://github.com/hashicorp/terraform/issues/16394