github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/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_policy" "lb_ro" {
    17      name = "test"
    18      user = "${aws_iam_user.lb.name}"
    19      policy = <<EOF
    20  {
    21    "Version": "2012-10-17",
    22    "Statement": [
    23      {
    24        "Action": [
    25          "ec2:Describe*"
    26        ],
    27        "Effect": "Allow",
    28        "Resource": "*"
    29      }
    30    ]
    31  }
    32  EOF
    33  }
    34  
    35  resource "aws_iam_user" "lb" {
    36      name = "loadbalancer"
    37      path = "/system/"
    38  }
    39  
    40  resource "aws_iam_access_key" "lb" {
    41      user = "${aws_iam_user.lb.name}"
    42  }
    43  ```
    44  
    45  ## Argument Reference
    46  
    47  The following arguments are supported:
    48  
    49  * `policy` - (Required) The policy document. This is a JSON formatted string.
    50  	The heredoc syntax or `file` function is helpful here.
    51  * `name` - (Required) Name of the policy.
    52  * `user` - (Required) IAM user to which to attach this policy.
    53  
    54  ## Attributes Reference
    55  
    56  This resource has no attributes.