{"action":"closed","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/2686","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/2686/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/2686/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/2686/events","html_url":"https://github.com/hashicorp/terraform/issues/2686","id":94398388,"number":2686,"title":"aws_iam_role gives syntax errors","user":{"login":"bdesilva","id":8118187,"avatar_url":"https://avatars.githubusercontent.com/u/8118187?v=3","gravatar_id":"","url":"https://api.github.com/users/bdesilva","html_url":"https://github.com/bdesilva","followers_url":"https://api.github.com/users/bdesilva/followers","following_url":"https://api.github.com/users/bdesilva/following{/other_user}","gists_url":"https://api.github.com/users/bdesilva/gists{/gist_id}","starred_url":"https://api.github.com/users/bdesilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdesilva/subscriptions","organizations_url":"https://api.github.com/users/bdesilva/orgs","repos_url":"https://api.github.com/users/bdesilva/repos","events_url":"https://api.github.com/users/bdesilva/events{/privacy}","received_events_url":"https://api.github.com/users/bdesilva/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-10T21:33:56Z","updated_at":"2015-07-11T17:02:31Z","closed_at":"2015-07-11T17:02:30Z","body":"Hi guys,\r\n\r\nI need to create a role dynamically so I use the proper terraform resource as follows:\r\n\r\n```ruby\r\nresource \"aws_iam_instance_profile\" \"elasticsearch_profile\" {\r\n  name = \"elasticsearch_profile\"\r\n  roles = [\"${aws_iam_role.ec2.name}\"]\r\n}\r\n\r\nresource \"aws_iam_role\" \"ec2\" {\r\n  name = \"elasticsearch_role\"\r\n  path = \"/\"\r\n  assume_role_policy = <<EOF\r\n  {\r\n      \"Version\": \"2012-10-17\",\r\n      \"Statement\": [\r\n      {\r\n        \"Effect\": \"Allow\",\r\n        \"Principal\": {\r\n          \"Service\": \"ec2.amazonaws.com\"\r\n        },\r\n      \"Action\": \"sts:AssumeRole\"\r\n      }\r\n    ]\r\n  }\r\n  EOF\r\n}\r\n\r\nresource \"aws_iam_policy_attachment\" \"elasticsearch_policy_attach\" {\r\n  name = \"elasticsearch_policy_attach\"\r\n  roles = [\"${aws_iam_role.ec2.name}\"]\r\n  policy_arn = \"arn:aws:iam::aws:policy/AmazonEC2FullAccess\"\r\n}\r\n```\r\n\r\nBut as per this image, you can see that I have errors showing up in the syntax, possibly because it's a mis-mash of regular syntax with AWS' JSON syntax for roles:\r\n\r\n<img width=\"487\" alt=\"screen shot 2015-07-10 at 2 30 56 pm\" src=\"https://cloud.githubusercontent.com/assets/8118187/8629462/7e333672-2710-11e5-8180-3e2702256a38.png\">\r\n\r\nAnd here's the error in the output:\r\n\r\n<img width=\"843\" alt=\"screen shot 2015-07-10 at 2 31 06 pm\" src=\"https://cloud.githubusercontent.com/assets/8118187/8629476/97f20c46-2710-11e5-8714-36ca59c6d92f.png\">\r\n\r\nCan someone please help me out with this?"}}