github.com/markdia/terraform@v0.5.1-0.20150508012022-f1ae920aa970/website/source/docs/providers/aws/r/iam_user_policy.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_iam_user_policy"
     4  sidebar_current: "docs-aws-resource-iam-user-policy"
     5  description: |-
     6    Provides an IAM policy attached to a user.
     7  ---
     8  
     9  # aws\_iam\_user\_policy
    10  
    11  Provides an IAM policy attached to a user.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  resource "aws_iam_user" "lb" {
    17      name = "loadbalancer"
    18      path = "/system/"
    19  }
    20  
    21  resource "aws_iam_access_key" "lb" {
    22      user = "${aws_iam_user.lb.name}"
    23      status = "Active"
    24  }
    25  
    26  resource "aws_iam_user_policy" "lb_ro" {
    27      name = "test"
    28      user = "${aws_iam_user.lb.name}"
    29      policy = <<EOF
    30  {
    31    "Version": "2012-10-17",
    32    "Statement": [
    33      {
    34        "Action": [
    35          "ec2:Describe*"
    36        ],
    37        "Effect": "Allow",
    38        "Resource": "*"
    39      }
    40    ]
    41  }
    42  EOF
    43  }
    44  ```
    45  
    46  ## Argument Reference
    47  
    48  The following arguments are supported:
    49  
    50  * `policy` - (Required) The policy document. This is a JSON formatted string.
    51  	The heredoc syntax or `file` function is helpful here.
    52  * `name` - (Required) Name of the policy.
    53  * `user` - (Required) IAM user to which to attach this policy.
    54  
    55  ## Attributes Reference
    56  
    57  This resource has no attributes.