-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.yaml
115 lines (94 loc) · 3.46 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: terraform-aws-iam-policy-document-aggregator
# Logo for this project
#logo: docs/logo.png
# License of this project
license: "APACHE2"
# Canonical GitHub repo
github_repo: cloudposse/terraform-aws-iam-policy-document-aggregator
# Badges to display
badges:
- name: "Build Status"
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/cloudposse%2Fterraform-aws-iam-policy-document-aggregator%2Flint?type=cf-1"
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/cloudposse/terraform-aws-iam-policy-document-aggregator/lint"
- name: "Latest Release"
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-iam-policy-document-aggregator.svg"
url: "https://github.com/cloudposse/terraform-aws-iam-policy-document-aggregator/releases/latest"
- name: "Slack Community"
image: "https://slack.cloudposse.com/badge.svg"
url: "https://slack.cloudposse.com"
related:
- name: "terraform-aws-iam-role"
description: "A Terraform module that creates IAM role with provided JSON IAM polices documents."
url: "https://github.com/cloudposse/terraform-aws-iam-role"
- name: "terraform-aws-iam-chamber-s3-role"
description: "Terraform module to provision an IAM role with configurable permissions to access S3 as chamber backend."
url: "https://github.com/cloudposse/terraform-aws-iam-chamber-s3-role"
# Short description of this project
description: |-
Terraform module to aggregate multiple IAM policy documents into single policy document.
# How to use this project
usage: |-
This example creates a single IAM policy document from multiple IAM policy documents.
```hcl
data "aws_iam_policy_document" "resource_full_access" {
statement {
sid = "FullAccess"
effect = "Allow"
resources = ["arn:aws:s3:::bucketname/path/*"]
actions = [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:GetBucketLocation",
"s3:AbortMultipartUpload",
]
}
}
data "aws_iam_policy_document" "base" {
statement {
sid = "BaseAccess"
actions = [
"s3:ListBucket",
"s3:ListBucketVersions",
]
resources = ["*"]
effect = "Allow"
}
}
module "aggregated_policy" {
source = "git::https://github.com/cloudposse/terraform-aws-iam-policy-document-aggregator.git?ref=master"
source_documents = [
"${data.aws_iam_policy_document.base.json}",
"${data.aws_iam_policy_document.resource_full_access.json}"
]
}
resource "aws_iam_role" "default" {
name = "example-role"
description = "IAM Role with permissions to perform actions on S3 resources"
}
resource "aws_iam_role_policy" "default" {
name = "example-policy"
description = "Allow S3 actions"
role = "${aws_iam_role.default.id}"
policy = "${module.aggregated_policy.result_document}"
}
```
### Additional Examples
The [`example`](./example) directory contains the example.
include:
- "docs/terraform.md"
# Contributors to this project
contributors:
- name: "Igor Rodionov"
github: "goruha"
- name: "Maxim Mironenko"
github: "maximmi"