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

Resource 'aws_iam_role_policy.example_policy' does not have attribute 'name' #6144

Closed
bakshi-gulam opened this issue Oct 13, 2018 · 4 comments · Fixed by #6304
Closed

Resource 'aws_iam_role_policy.example_policy' does not have attribute 'name' #6144

bakshi-gulam opened this issue Oct 13, 2018 · 4 comments · Fixed by #6304
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service.
Milestone

Comments

@bakshi-gulam
Copy link

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

Terraform Version

Terraform v0.11.8

  • provider.aws v1.40.0
  • provider.template v1.0.0

Affected Resource(s)

  • aws_iam_role_policy

Terraform Configuration Files

resource "aws_s3_bucket" "example_bucket" {
}

resource "aws_iam_role" "example_role" {
  name = "example-role"

  assume_role_policy = <<EOF
{  
  "Version": "2012-10-17",
  "Statement": [
    {  
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "ec2.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
EOF
}

resource "aws_iam_role_policy" "example_role_policy" {
  role = "${aws_iam_role.example_role.id}"

  policy = <<EOF
{
  "Id": "Policy1539344357144",
  "Version": "2012-10-17",
  "Statement": [
    { 
      "Sid": "Stmt1539344320966",
      "Action": "s3:*",
      "Effect": "Allow",
      "Resource": "${aws_s3_bucket.example_bucket.arn}/*"
    }
  ]
}
EOF
}

Expected Behavior

$ terraform state show aws_iam_role_policy.example_role_policy
id = example-role:terraform-2018xxxxxxxxxxxxxxxxxxxxxxxxx
name = terraform-2018xxxxxxxxxxxxxxxxxxxxxxxxx
policy = {
"Id": "Policy1539344357144",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1539344320966",
"Action": "s3:",
"Effect": "Allow",
"Resource": "arn:aws:s3:::terraform-2018xxxxxxxxxxxxxxxxxxxxxxxxx/
"
}
]
}
role = example-role

Actual Behavior

$ terraform state show aws_iam_role_policy.example_role_policy
id = example-role:terraform-2018xxxxxxxxxxxxxxxxxxxxxxxxx
policy = {
"Id": "Policy1539344357144",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1539344320966",
"Action": "s3:",
"Effect": "Allow",
"Resource": "arn:aws:s3:::terraform-2018xxxxxxxxxxxxxxxxxxxxxxxxx/
"
}
]
}
role = example-role

Steps to Reproduce

  1. save the code as .tf and issue terraform apply
@bflad bflad added bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. labels Oct 14, 2018
@saravanan30erd
Copy link
Contributor

will work on it.

@bflad bflad added this to the v1.42.0 milestone Oct 30, 2018
bflad added a commit that referenced this issue Oct 30, 2018
Issue #6144 Resource 'aws_iam_role_policy.example_policy' does not have attribute 'name'
@bflad
Copy link
Contributor

bflad commented Oct 30, 2018

The fix for this has been merged and will release with version 1.42.0 of the AWS provider, likely today or tomorrow. 👍

@bflad
Copy link
Contributor

bflad commented Nov 1, 2018

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

@ghost
Copy link

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

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service.
Projects
None yet
3 participants