github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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 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 36 ## Argument Reference 37 38 The following arguments are supported: 39 40 * `description` - (Optional) Description of the IAM policy. 41 * `name` - (Optional, Forces new resource) The name of the policy. 42 * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. 43 * `path` - (Optional, default "/") Path in which to create the policy. 44 See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 45 * `policy` - (Required) The policy document. This is a JSON formatted string. 46 The heredoc syntax, `file` function, or the [`aws_iam_policy_document` data 47 source](/docs/providers/aws/d/iam_policy_document.html) 48 are all helpful here. 49 50 ## Attributes Reference 51 52 The following attributes are exported: 53 54 * `id` - The policy's ID. 55 * `arn` - The ARN assigned by AWS to this policy. 56 * `description` - The description of the policy. 57 * `name` - The name of the policy. 58 * `path` - The path of the policy in IAM. 59 * `policy` - The policy document. 60 61 ## Import 62 63 IAM Policies can be imported using the `arn`, e.g. 64 65 ``` 66 $ terraform import aws_iam_policy.administrator arn:aws:iam::123456789012:policy/UsersManageOwnCredentials 67 ```