github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/website/source/docs/providers/aws/r/iam_policy.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_iam_policy"
     4  sidebar_current: "docs-aws-resource-iam-policy"
     5  description: |-
     6    Provides an IAM policy.
     7  ---
     8  
     9  # aws\_iam\_policy
    10  
    11  Provides an IAM policy.
    12  
    13  ```
    14  resource "aws_iam_policy" "policy" {
    15      name = "test_policy"
    16      path = "/"
    17      description = "My test policy"
    18      policy = <<EOF
    19  {
    20    "Version": "2012-10-17",
    21    "Statement": [
    22      {
    23        "Action": [
    24          "ec2:Describe*"
    25        ],
    26        "Effect": "Allow",
    27        "Resource": "*"
    28      }
    29    ]
    30  }
    31  EOF
    32  }
    33  ```
    34  
    35  ## Argument Reference
    36  
    37  The following arguments are supported:
    38  
    39  * `description` - (Optional) Description of the IAM policy.
    40  * `name` - (Optional, Forces new resource) The name of the policy.
    41  * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`.
    42  * `path` - (Optional, default "/") Path in which to create the policy.
    43    See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information.
    44  * `policy` - (Required) The policy document. This is a JSON formatted string.
    45    The heredoc syntax, `file` function, or the [`aws_iam_policy_document` data
    46    source](/docs/providers/aws/d/iam_policy_document.html)
    47    are all helpful here.
    48  
    49  ## Attributes Reference
    50  
    51  The following attributes are exported:
    52  
    53  * `id` - The policy's ID.
    54  * `arn` - The ARN assigned by AWS to this policy.
    55  * `description` - The description of the policy.
    56  * `name` - The name of the policy.
    57  * `path` - The path of the policy in IAM.
    58  * `policy` - The policy document.
    59  
    60  ## Import
    61  
    62  IAM Policies can be imported using the `arn`, e.g.
    63  
    64  ```
    65  $ terraform import aws_iam_policy.administrator arn:aws:iam::123456789012:policy/UsersManageOwnCredentials
    66  ```