Skip to content

Commit 3c59715

Browse files
authored
feat: Add role unique_id output in iam-assumable-role module (#143)
1 parent 013320e commit 3c59715

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.github/workflows/pre-commit.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ on:
77
- master
88

99
jobs:
10-
# Min Terraform version(s)
10+
# Min Terraform version(s)
1111
getDirectories:
12-
name: Get root directories
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
- name: Install Python
18-
uses: actions/setup-python@v2
19-
- name: Build matrix
20-
id: matrix
21-
run: |
22-
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
23-
echo "::set-output name=directories::$DIRS"
24-
outputs:
25-
directories: ${{ steps.matrix.outputs.directories }}
12+
name: Get root directories
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Install Python
18+
uses: actions/setup-python@v2
19+
- name: Build matrix
20+
id: matrix
21+
run: |
22+
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
23+
echo "::set-output name=directories::$DIRS"
24+
outputs:
25+
directories: ${{ steps.matrix.outputs.directories }}
2626

2727
preCommitMinVersions:
2828
name: Min TF validate
2929
needs: getDirectories
3030
runs-on: ubuntu-latest
3131
strategy:
32-
matrix:
33-
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
32+
matrix:
33+
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v2
@@ -59,7 +59,7 @@ jobs:
5959
pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
6060

6161

62-
# Max Terraform version
62+
# Max Terraform version
6363
getBaseVersion:
6464
name: Module max TF version
6565
runs-on: ubuntu-latest
@@ -94,7 +94,7 @@ jobs:
9494
- name: Install pre-commit dependencies
9595
run: |
9696
pip install pre-commit
97-
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12.0-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
97+
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12\..+?-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
9898
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
9999
- name: Execute pre-commit
100100
# Run all pre-commit checks on max version supported

modules/iam-assumable-role/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ No modules.
7575
| <a name="output_this_iam_role_arn"></a> [this\_iam\_role\_arn](#output\_this\_iam\_role\_arn) | ARN of IAM role |
7676
| <a name="output_this_iam_role_name"></a> [this\_iam\_role\_name](#output\_this\_iam\_role\_name) | Name of IAM role |
7777
| <a name="output_this_iam_role_path"></a> [this\_iam\_role\_path](#output\_this\_iam\_role\_path) | Path of IAM role |
78+
| <a name="output_this_iam_role_unique_id"></a> [this\_iam\_role\_unique\_id](#output\_this\_iam\_role\_unique\_id) | Unique ID of IAM role |
7879
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

modules/iam-assumable-role/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ output "this_iam_role_path" {
1313
value = element(concat(aws_iam_role.this.*.path, [""]), 0)
1414
}
1515

16+
output "this_iam_role_unique_id" {
17+
description = "Unique ID of IAM role"
18+
value = element(concat(aws_iam_role.this.*.unique_id, [""]), 0)
19+
}
20+
1621
output "role_requires_mfa" {
1722
description = "Whether IAM role requires MFA"
1823
value = var.role_requires_mfa

0 commit comments

Comments
 (0)