github.com/acm1/terraform@v0.6.2-0.20150729164239-1f314444f45c/website/source/docs/providers/aws/r/iam_policy_attachment.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_iam_policy_attachment"
     4  sidebar_current: "docs-aws-resource-iam-policy-attachment"
     5  description: |-
     6    Attaches a Managed IAM Policy to user(s), role(s), and/or group(s)
     7  ---
     8  
     9  # aws\_iam\_policy\_attachment
    10  
    11  Attaches a Managed IAM Policy to user(s), role(s), and/or group(s)
    12  
    13  ```
    14  resource "aws_iam_user" "user" {
    15      name = "test-user"
    16  }
    17  resource "aws_iam_role" "role" {
    18      name = "test-role"
    19  }
    20  resource "aws_iam_group" "group" {
    21      name = "test-group"
    22  }
    23  
    24  resource "aws_iam_policy" "policy" {
    25      name = "test-policy"
    26      description = "A test policy"
    27      policy = 	#omitted
    28  }
    29  
    30  resource "aws_iam_policy_attachment" "test-attach" {
    31      name = "test-attachment"
    32      users = ["${aws_iam_user.user.name}"]
    33      roles = ["${aws_iam_role.role.name}"]
    34      groups = ["${aws_iam_group.group.name}"]
    35      policy_arn = "${aws_iam_policy.policy.arn}"
    36  }
    37  ```
    38  
    39  ## Argument Reference
    40  
    41  The following arguments are supported:
    42  
    43  * `name` 		(Required) - The name of the policy.
    44  * `users`		(Optional) - The user(s) the policy should be applied to
    45  * `roles`		(Optional) - The role(s) the policy should be applied to
    46  * `groups`		(Optional) - The group(s) the policy should be applied to
    47  * `policy_arn`	(Required) - The ARN of the policy you want to apply
    48  
    49  ## Attributes Reference
    50  
    51  The following attributes are exported:
    52  
    53  * `id` - The policy's ID.
    54  * `name` - The name of the policy.