Skip to content

Commit 3a008ad

Browse files
Add policy boundary and enable_tags for iam resouces (#32)
* Adding permission boundary and optional tags on roles * Adding policy boundary and updates tag variable name * Auto Format * Adding policy boundary and updates tag variable name * Auto Format Co-authored-by: cloudpossebot <[email protected]>
1 parent 1dc6e97 commit 3a008ad

File tree

10 files changed

+93
-10
lines changed

10 files changed

+93
-10
lines changed

.github/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ template: |
4747
4848
replacers:
4949
# Remove irrelevant information from Renovate bot
50-
- search: '/(?<=---\s+)+^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
50+
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
5151
replace: ''
5252
# Remove Renovate bot banner image
5353
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'

.github/workflows/auto-context.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
3636
- name: Create Pull Request
3737
if: steps.update.outputs.create_pull_request == 'true'
38-
uses: cloudposse/actions/github/create-pull-request@0.22.0
38+
uses: cloudposse/actions/github/create-pull-request@0.30.0
3939
with:
4040
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
4141
committer: 'cloudpossebot <[email protected]>'

.github/workflows/auto-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
fi
6363
6464
- name: Auto Test
65-
uses: cloudposse/actions/github/repository-dispatch@0.22.0
65+
uses: cloudposse/actions/github/repository-dispatch@0.30.0
6666
# match users by ID because logins (user names) are inconsistent,
6767
# for example in the REST API Renovate Bot is `renovate[bot]` but
6868
# in GraphQL it is just `renovate`, plus there is a non-bot

.github/workflows/auto-readme.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: "auto-readme"
2+
on:
3+
workflow_dispatch:
4+
5+
schedule:
6+
# Example of job definition:
7+
# .---------------- minute (0 - 59)
8+
# | .------------- hour (0 - 23)
9+
# | | .---------- day of month (1 - 31)
10+
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
11+
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
12+
# | | | | |
13+
# * * * * * user-name command to be executed
14+
15+
# Update README.md nightly at 4am UTC
16+
- cron: '0 4 * * *'
17+
18+
jobs:
19+
update:
20+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Find default branch name
26+
id: defaultBranch
27+
shell: bash
28+
env:
29+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30+
run: |
31+
default_branch=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
32+
printf "::set-output name=defaultBranch::%s\n" "${default_branch}"
33+
printf "defaultBranchRef.name=%s\n" "${default_branch}"
34+
35+
- name: Update readme
36+
shell: bash
37+
id: update
38+
env:
39+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
40+
DEF: "${{ steps.defaultBranch.outputs.defaultBranch }}"
41+
run: |
42+
make init
43+
make readme/build
44+
# Ignore changes if they are only whitespace
45+
if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then
46+
git restore README.md
47+
echo Ignoring whitespace-only changes in README
48+
fi
49+
50+
- name: Create Pull Request
51+
# This action will not create or change a pull request if there are no changes to make.
52+
# If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
53+
uses: cloudposse/actions/github/[email protected]
54+
with:
55+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
56+
commit-message: Update README.md and docs
57+
title: Update README.md and docs
58+
body: |-
59+
## what
60+
This is an auto-generated PR that updates the README.md and docs
61+
62+
## why
63+
To have most recent changes of README.md and doc from origin templates
64+
65+
branch: auto-update/readme
66+
base: ${{ steps.defaultBranch.outputs.defaultBranch }}
67+
delete-branch: true
68+
labels: |
69+
auto-update
70+
no-release
71+
readme

.github/workflows/chatops.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: "Handle common commands"
12-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
12+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
1313
with:
1414
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
1515
reaction-token: ${{ secrets.GITHUB_TOKEN }}
@@ -24,7 +24,7 @@ jobs:
2424
- name: "Checkout commit"
2525
uses: actions/checkout@v2
2626
- name: "Run tests"
27-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
27+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
2828
with:
2929
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
3030
reaction-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate-codeowners.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ jobs:
1010
steps:
1111
- name: "Checkout source code at current commit"
1212
uses: actions/checkout@v2
13-
- uses: mszostok/codeowners-validator@v0.5.0
13+
- uses: mszostok/codeowners-validator@v0.7.1
1414
if: github.event.pull_request.head.repo.full_name == github.repository
1515
name: "Full check of CODEOWNERS"
1616
with:
1717
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
1818
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
1919
# checks: "files,syntax,owners,duppatterns"
2020
checks: "syntax,owners,duppatterns"
21+
owner_checker_allow_unowned_patterns: "false"
2122
# GitHub access token is required only if the `owners` check is enabled
2223
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
23-
- uses: mszostok/codeowners-validator@v0.5.0
24+
- uses: mszostok/codeowners-validator@v0.7.1
2425
if: github.event.pull_request.head.repo.full_name != github.repository
2526
name: "Syntax check of CODEOWNERS"
2627
with:
2728
checks: "syntax,duppatterns"
29+
owner_checker_allow_unowned_patterns: "false"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Available targets:
146146
| Name | Source | Version |
147147
|------|--------|---------|
148148
| <a name="module_log_group_label"></a> [log\_group\_label](#module\_log\_group\_label) | cloudposse/label/null | 0.25.0 |
149-
| <a name="module_role"></a> [role](#module\_role) | cloudposse/iam-role/aws | 0.15.0 |
149+
| <a name="module_role"></a> [role](#module\_role) | cloudposse/iam-role/aws | 0.16.1 |
150150
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
151151

152152
## Resources
@@ -170,6 +170,7 @@ Available targets:
170170
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
171171
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
172172
| <a name="input_iam_role_enabled"></a> [iam\_role\_enabled](#input\_iam\_role\_enabled) | Whether to create an IAM role which is able to write logs to the CloudWatch Logs log group | `bool` | `true` | no |
173+
| <a name="input_iam_tags_enabled"></a> [iam\_tags\_enabled](#input\_iam\_tags\_enabled) | Enable/disable tags on IAM roles and policies | `string` | `true` | no |
173174
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
174175
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of the KMS Key to use when encrypting log data.<br><br>Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group.<br><br>All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested. | `string` | `""` | no |
175176
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |

docs/terraform.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| Name | Source | Version |
1818
|------|--------|---------|
1919
| <a name="module_log_group_label"></a> [log\_group\_label](#module\_log\_group\_label) | cloudposse/label/null | 0.25.0 |
20-
| <a name="module_role"></a> [role](#module\_role) | cloudposse/iam-role/aws | 0.15.0 |
20+
| <a name="module_role"></a> [role](#module\_role) | cloudposse/iam-role/aws | 0.16.1 |
2121
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
2222

2323
## Resources
@@ -41,6 +41,7 @@
4141
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
4242
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
4343
| <a name="input_iam_role_enabled"></a> [iam\_role\_enabled](#input\_iam\_role\_enabled) | Whether to create an IAM role which is able to write logs to the CloudWatch Logs log group | `bool` | `true` | no |
44+
| <a name="input_iam_tags_enabled"></a> [iam\_tags\_enabled](#input\_iam\_tags\_enabled) | Enable/disable tags on IAM roles and policies | `string` | `true` | no |
4445
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
4546
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of the KMS Key to use when encrypting log data.<br><br>Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group.<br><br>All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested. | `string` | `""` | no |
4647
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |

iam.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ locals {
44

55
module "role" {
66
source = "cloudposse/iam-role/aws"
7-
version = "0.15.0"
7+
version = "0.16.1"
88

99
enabled = local.iam_role_enabled
1010

@@ -20,6 +20,8 @@ module "role" {
2020
]
2121

2222
permissions_boundary = var.permissions_boundary
23+
tags_enabled = var.iam_tags_enabled
24+
2325

2426
context = module.this.context
2527
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ variable "permissions_boundary" {
5050
default = ""
5151
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
5252
}
53+
54+
variable "iam_tags_enabled" {
55+
type = string
56+
description = "Enable/disable tags on IAM roles and policies"
57+
default = true
58+
}

0 commit comments

Comments
 (0)