Skip to content

Commit

Permalink
Adds a more useful, 0.12+ README example (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowiem authored Sep 30, 2020
1 parent 1c1a22a commit 146fbf8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 54 deletions.
49 changes: 22 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,41 +84,36 @@ module "circleci" {
## Examples

```hcl
data "aws_iam_policy_document" "fluentd_user_policy" {
statement {
actions = [
"logs:DescribeDestinations",
"logs:DescribeExportTasks",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams",
"logs:DescribeMetricFilters",
"logs:DescribeSubscriptionFilters",
"logs:FilterLogEvents",
"logs:GetLogEvents",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams",
"logs:CreateLogStream",
"logs:DeleteLogStream",
]
resources = ["*"]
}
}
module "fluentd_user" {
source = "git::https://github.com/cloudposse/terraform-aws-iam-system-user.git?ref=master"
namespace = "eg"
stage = "dev"
name = "fluentd"
policy_arns_map = {
logs = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
}
inline_policies_map = {
s3 = aws_iam_policy_document.s3_policy.json
}
}
data "aws_iam_policy_document" "s3_policy" {
statement {
actions = [
"s3:PutObject",
"s3:GetObjectAcl",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObjectAcl"
]
resource "aws_iam_user_policy" "default" {
name = "${module.fluentd_user.user_name}"
user = "${module.fluentd_user.user_name}"
policy = "${data.aws_iam_policy_document.fluentd_user_policy.json}"
resources = [
"arn:aws:s3:::bucket_name/*",
"arn:aws:s3:::bucket_name/"
]
}
}
```

Expand Down
49 changes: 22 additions & 27 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,41 +78,36 @@ usage: |-
examples: |-
```hcl
data "aws_iam_policy_document" "fluentd_user_policy" {
statement {
actions = [
"logs:DescribeDestinations",
"logs:DescribeExportTasks",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams",
"logs:DescribeMetricFilters",
"logs:DescribeSubscriptionFilters",
"logs:FilterLogEvents",
"logs:GetLogEvents",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams",
"logs:CreateLogStream",
"logs:DeleteLogStream",
]
resources = ["*"]
}
}
module "fluentd_user" {
source = "git::https://github.com/cloudposse/terraform-aws-iam-system-user.git?ref=master"
namespace = "eg"
stage = "dev"
name = "fluentd"
policy_arns_map = {
logs = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
}
inline_policies_map = {
s3 = aws_iam_policy_document.s3_policy.json
}
}
data "aws_iam_policy_document" "s3_policy" {
statement {
actions = [
"s3:PutObject",
"s3:GetObjectAcl",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObjectAcl"
]
resource "aws_iam_user_policy" "default" {
name = "${module.fluentd_user.user_name}"
user = "${module.fluentd_user.user_name}"
policy = "${data.aws_iam_policy_document.fluentd_user_policy.json}"
resources = [
"arn:aws:s3:::bucket_name/*",
"arn:aws:s3:::bucket_name/"
]
}
}
```
Expand Down

0 comments on commit 146fbf8

Please sign in to comment.