Skip to content

Commit

Permalink
provider/aws: Add per user, role and group policy attachment (superse…
Browse files Browse the repository at this point in the history
…des #5816) (#6858)

* Add per user, role and group policy attachment

* Add docs for new IAM policy attachment resources.

* Make policy attachment resources manage only 1 entity<->policy attachment

* provider/aws: Tidy up IAM Group/User/Role attachments
  • Loading branch information
catsby committed May 25, 2016
1 parent a17ba75 commit f69df9c
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
35 changes: 35 additions & 0 deletions r/iam_group_policy_attachment.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: "aws"
page_title: "AWS: aws_iam_group_policy_attachment"
sidebar_current: "docs-aws-resource-iam-group-policy-attachment"
description: |-
Attaches a Managed IAM Policy to an IAM group
---

# aws\_iam\_group\_policy\_attachment

Attaches a Managed IAM Policy to an IAM group

```
resource "aws_iam_group" "group" {
name = "test-group"
}
resource "aws_iam_policy" "policy" {
name = "test-policy"
description = "A test policy"
policy = #omitted
}
resource "aws_iam_group_policy_attachment" "test-attach" {
group = "${aws_iam_group.group.name}"
policy_arn = "${aws_iam_policy.policy.arn}"
}
```

## Argument Reference

The following arguments are supported:

* `group` (Required) - The group the policy should be applied to
* `policy_arn` (Required) - The ARN of the policy you want to apply
35 changes: 35 additions & 0 deletions r/iam_role_policy_attachment.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: "aws"
page_title: "AWS: aws_iam_role_policy_attachment"
sidebar_current: "docs-aws-resource-iam-role-policy-attachment"
description: |-
Attaches a Managed IAM Policy to an IAM role
---

# aws\_iam\_role\_policy\_attachment

Attaches a Managed IAM Policy to an IAM role

```
resource "aws_iam_role" "role" {
name = "test-role"
}
resource "aws_iam_policy" "policy" {
name = "test-policy"
description = "A test policy"
policy = #omitted
}
resource "aws_iam_role_policy_attachment" "test-attach" {
role = "${aws_iam_role.role.name}"
policy_arn = "${aws_iam_policy.policy.arn}"
}
```

## Argument Reference

The following arguments are supported:

* `role` (Required) - The role the policy should be applied to
* `policy_arn` (Required) - The ARN of the policy you want to apply
35 changes: 35 additions & 0 deletions r/iam_user_policy_attachment.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: "aws"
page_title: "AWS: aws_iam_user_policy_attachment"
sidebar_current: "docs-aws-resource-iam-user-policy-attachment"
description: |-
Attaches a Managed IAM Policy to an IAM user
---

# aws\_iam\_user\_policy\_attachment

Attaches a Managed IAM Policy to an IAM user

```
resource "aws_iam_user" "user" {
name = "test-user"
}
resource "aws_iam_policy" "policy" {
name = "test-policy"
description = "A test policy"
policy = #omitted
}
resource "aws_iam_user_policy_attachment" "test-attach" {
user = "${aws_iam_user.user.name}"
policy_arn = "${aws_iam_policy.policy.arn}"
}
```

## Argument Reference

The following arguments are supported:

* `user` (Required) - The user the policy should be applied to
* `policy_arn` (Required) - The ARN of the policy you want to apply

0 comments on commit f69df9c

Please sign in to comment.