github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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  ```hcl
    16  resource "aws_iam_user_policy" "lb_ro" {
    17    name = "test"
    18    user = "${aws_iam_user.lb.name}"
    19  
    20    policy = <<EOF
    21  {
    22    "Version": "2012-10-17",
    23    "Statement": [
    24      {
    25        "Action": [
    26          "ec2:Describe*"
    27        ],
    28        "Effect": "Allow",
    29        "Resource": "*"
    30      }
    31    ]
    32  }
    33  EOF
    34  }
    35  
    36  resource "aws_iam_user" "lb" {
    37    name = "loadbalancer"
    38    path = "/system/"
    39  }
    40  
    41  resource "aws_iam_access_key" "lb" {
    42    user = "${aws_iam_user.lb.name}"
    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` - (Optional) The name of the policy. If omitted, Terraform will assign a random, unique name.
    53  * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`.
    54  * `user` - (Required) IAM user to which to attach this policy.
    55  
    56  ## Attributes Reference
    57  
    58  This resource has no attributes.