Merge pull request #1935 from TimeIncOSS/iam_role_docs

Add docs for aws_iam_role + clean up examples in IAM docs
This commit is contained in:
Radek Simko 2015-05-12 22:50:32 +01:00
commit a4c9dd6271
7 changed files with 96 additions and 43 deletions

View File

@ -13,16 +13,16 @@ Provides an IAM access key. This is a set of credentials that allow API requests
## Example Usage ## Example Usage
``` ```
resource "aws_iam_user" "lb" {
name = "loadbalancer"
path = "/system/"
}
resource "aws_iam_access_key" "lb" { resource "aws_iam_access_key" "lb" {
user = "${aws_iam_user.lb.name}" user = "${aws_iam_user.lb.name}"
status = "Active" status = "Active"
} }
resource "aws_iam_user" "lb" {
name = "loadbalancer"
path = "/system/"
}
resource "aws_iam_user_policy" "lb_ro" { resource "aws_iam_user_policy" "lb_ro" {
name = "test" name = "test"
user = "${aws_iam_user.lb.name}" user = "${aws_iam_user.lb.name}"

View File

@ -13,11 +13,6 @@ Provides an IAM policy attached to a group.
## Example Usage ## Example Usage
``` ```
resource "aws_iam_group" "my_developers" {
name = "developers"
path = "/users/"
}
resource "iam_group_policy" "my_developer_policy" { resource "iam_group_policy" "my_developer_policy" {
name = "my_developer_policy" name = "my_developer_policy"
group = "${aws_iam_group.my_developers.id}" group = "${aws_iam_group.my_developers.id}"
@ -36,6 +31,11 @@ resource "iam_group_policy" "my_developer_policy" {
} }
EOF EOF
} }
resource "aws_iam_group" "my_developers" {
name = "developers"
path = "/users/"
}
``` ```
## Argument Reference ## Argument Reference

View File

@ -13,10 +13,15 @@ Provides an IAM instance profile.
## Example Usage ## Example Usage
``` ```
resource "aws_iam_instance_profile" "test_profile" {
name = "test_profile"
roles = ["${aws_iam_role.role.name}"]
}
resource "aws_iam_role" "role" { resource "aws_iam_role" "role" {
name = "test_role" name = "test_role"
path = "/" path = "/"
policy = <<EOF assume_role_policy = <<EOF
{ {
"Version": "2012-10-17", "Version": "2012-10-17",
"Statement": [ "Statement": [
@ -31,11 +36,6 @@ resource "aws_iam_role" "role" {
} }
EOF EOF
} }
resource "aws_iam_instance_profile" "test_profile" {
name = "test_profile"
roles = ["${aws_iam_role.role.name}"]
}
``` ```
## Argument Reference ## Argument Reference

View File

@ -0,0 +1,48 @@
---
layout: "aws"
page_title: "AWS: aws_iam_role"
sidebar_current: "docs-aws-resource-iam-role"
description: |-
Provides an IAM role.
---
# aws\_iam\_role
Provides an IAM role.
## Example Usage
```
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the role.
* `assume_role_policy` - (Required) The policy that grants an entity permission to assume the role.
* `path` - (Optional) The path to the role.
See [IAM Identifiers](http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information.
## Attributes Reference
* `arn` - The Amazon Resource Name (ARN) specifying the role.
* `unique_id` - The stable and unique string identifying the role.

View File

@ -13,6 +13,24 @@ Provides an IAM role policy.
## Example Usage ## Example Usage
``` ```
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = "${aws_iam_role.test_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:Describe*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
EOF
resource "aws_iam_role" "test_role" { resource "aws_iam_role" "test_role" {
name = "test_role" name = "test_role"
assume_role_policy = <<EOF assume_role_policy = <<EOF
@ -31,23 +49,6 @@ resource "aws_iam_role" "test_role" {
} }
EOF EOF
} }
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = "${aws_iam_role.test_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:Describe*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
``` ```
## Argument Reference ## Argument Reference

View File

@ -13,16 +13,6 @@ Provides an IAM policy attached to a user.
## Example Usage ## Example Usage
``` ```
resource "aws_iam_user" "lb" {
name = "loadbalancer"
path = "/system/"
}
resource "aws_iam_access_key" "lb" {
user = "${aws_iam_user.lb.name}"
status = "Active"
}
resource "aws_iam_user_policy" "lb_ro" { resource "aws_iam_user_policy" "lb_ro" {
name = "test" name = "test"
user = "${aws_iam_user.lb.name}" user = "${aws_iam_user.lb.name}"
@ -41,6 +31,16 @@ resource "aws_iam_user_policy" "lb_ro" {
} }
EOF EOF
} }
resource "aws_iam_user" "lb" {
name = "loadbalancer"
path = "/system/"
}
resource "aws_iam_access_key" "lb" {
user = "${aws_iam_user.lb.name}"
status = "Active"
}
``` ```
## Argument Reference ## Argument Reference

View File

@ -81,6 +81,10 @@
<a href="/docs/providers/aws/r/iam_policy.html">aws_iam_policy</a> <a href="/docs/providers/aws/r/iam_policy.html">aws_iam_policy</a>
</li> </li>
<li<%= sidebar_current("docs-aws-resource-iam-role") %>>
<a href="/docs/providers/aws/r/iam_role.html">aws_iam_role</a>
</li>
<li<%= sidebar_current("docs-aws-resource-iam-role-policy") %>> <li<%= sidebar_current("docs-aws-resource-iam-role-policy") %>>
<a href="/docs/providers/aws/r/iam_role_policy.html">aws_iam_role_policy</a> <a href="/docs/providers/aws/r/iam_role_policy.html">aws_iam_role_policy</a>
</li> </li>