Skip to content

Commit 163ddce

Browse files
authored
fix: update github action and readme and terraform version (#20)
* fix: update github action and readme and terraform version * fix: update terraform version
1 parent 2bab8c3 commit 163ddce

19 files changed

+130
-92
lines changed

.editorconfig

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
# Uses editorconfig to maintain consistent coding styles
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Unix-style newlines with a newline ending every file
8+
[*]
9+
charset = utf-8
10+
end_of_line = lf
11+
indent_size = 2
12+
indent_style = space
13+
insert_final_newline = true
14+
max_line_length = 80
15+
trim_trailing_whitespace = true
16+
17+
[*.{tf,tfvars}]
18+
indent_size = 2
19+
indent_style = space
20+
21+
[*.md]
22+
max_line_length = 0
23+
trim_trailing_whitespace = false
24+
25+
[Makefile]
26+
tab_width = 2
27+
indent_style = tab
28+
29+
[COMMIT_EDITMSG]
30+
max_line_length = 0

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# These owners will be the default owners for everything in the repo.
2+
* @anmolnagpal @clouddrove/approvers @clouddrove-ci

.github/PULL_REQUEST_TEMPLATE.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## what
2+
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
3+
* Use bullet points to be concise and to the point.
4+
5+
## why
6+
* Provide the justifications for the changes (e.g. business case).
7+
* Describe why these changes were made (e.g. why do these commits fix the problem?)
8+
* Use bullet points to be concise and to the point.
9+
10+
## references
11+
* Link to any supporting jira issues or helpful documentation to add some context (e.g. stackoverflow).
12+
* Use `closes #123`, if this PR closes a Jira issue `#123`

.github/dependabot.yml

+18-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55

66
version: 2
77
updates:
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
open-pull-requests-limit: 3
14+
assignees:
15+
- "clouddrove-ci"
16+
reviewers:
17+
- "approvers"
18+
819
- package-ecosystem: "terraform" # See documentation for possible values
920
directory: "/" # Location of package manifests
1021
schedule:
@@ -15,13 +26,18 @@ updates:
1526
# Add reviewer
1627
reviewers:
1728
- "approvers"
29+
# Allow up to 3 open pull requests for pip dependencies
30+
open-pull-requests-limit: 3
31+
1832
- package-ecosystem: "terraform" # See documentation for possible values
19-
directory: "_example/complete/" # Location of package manifests
33+
directory: "/_example/complete" # Location of package manifests
2034
schedule:
2135
interval: "weekly"
2236
# Add assignees
2337
assignees:
2438
- "clouddrove-ci"
2539
# Add reviewer
2640
reviewers:
27-
- "approvers"
41+
- "approvers"
42+
# Allow up to 3 open pull requests for pip dependencies
43+
open-pull-requests-limit: 3

.github/workflows/auto_assignee.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
workflow_dispatch:
66
jobs:
77
assignee:
8-
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
8+
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.0.6
99
secrets:
1010
GITHUB: ${{ secrets.GITHUB }}
1111
with:
12-
assignees: 'clouddrove-ci'
12+
assignees: 'clouddrove-ci'

.github/workflows/changelog.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
jobs:
99
changelog:
10-
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
10+
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.0.6
1111
secrets: inherit
1212
with:
13-
branch: 'master'
13+
branch: 'master'

.github/workflows/readme.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ jobs:
1717
python-version: '3.x'
1818

1919
- name: 'create readme'
20-
uses: 'clouddrove/github-actions@v9.0.2'
20+
uses: 'clouddrove/github-actions@9.0.3'
2121
with:
2222
actions_subcommand: 'readme'
2323
github_token: '${{ secrets.GITHUB }}'
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626

27-
2827
- name: 'pre-commit check errors'
2928
uses: pre-commit/[email protected]
3029
continue-on-error: true
@@ -34,7 +33,7 @@ jobs:
3433
continue-on-error: true
3534

3635
- name: 'push readme'
37-
uses: 'clouddrove/github-actions@v9.0.2'
36+
uses: 'clouddrove/github-actions@9.0.3'
3837
continue-on-error: true
3938
with:
4039
actions_subcommand: 'push'
@@ -50,4 +49,4 @@ jobs:
5049
env:
5150
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
5251
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
53-
if: always()
52+
if: always()

.github/workflows/tf-checks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
pull_request:
66
workflow_dispatch:
77
jobs:
8-
tf-checks-complete-example:
9-
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
8+
complete-example:
9+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.6
1010
with:
1111
working_directory: './_example/complete/'

.github/workflows/tflint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ on:
66
workflow_dispatch:
77
jobs:
88
tf-lint:
9-
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
9+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.6
1010
secrets:
11-
GITHUB: ${{ secrets.GITHUB }}
11+
GITHUB: ${{ secrets.GITHUB }}

.github/workflows/tfsec.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
jobs:
77
tfsec:
8-
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
8+
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.0.6
99
secrets: inherit
1010
with:
11-
working_directory: '.'
11+
working_directory: '.'

README.yaml

+22-24
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,18 @@ github_repo: clouddrove/terraform-aws-iam-role
1515

1616
# Badges to display
1717
badges:
18-
- name: "Terraform"
19-
image: "https://img.shields.io/badge/Terraform-v1.1.7-green"
20-
url: "https://www.terraform.io"
21-
- name: "Licence"
22-
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
23-
url: "LICENSE.md"
18+
- name: "Latest Release"
19+
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-iam-role.svg"
20+
url: "https://github.com/clouddrove/terraform-aws-iam-role/releases/latest"
2421
- name: "tfsec"
2522
image: "https://github.com/clouddrove/terraform-aws-iam-role/actions/workflows/tfsec.yml/badge.svg"
2623
url: "https://github.com/clouddrove/terraform-aws-iam-role/actions/workflows/tfsec.yml"
27-
- name: "static-checks"
28-
image: "https://github.com/clouddrove/terraform-aws-iam-role/actions/workflows/terraform.yml/badge.svg"
29-
url: "https://github.com/clouddrove/terraform-aws-iam-role/actions/workflows/terraform.yml"
24+
- name: "Licence"
25+
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
26+
url: "LICENSE.md"
3027

3128
prerequesties:
32-
- name: Terraform 1.5.4
29+
- name: Terraform 1.5.6
3330
url: https://learn.hashicorp.com/terraform/getting-started/install.html
3431

3532
# description of this project
@@ -47,21 +44,19 @@ usage: |-
4744
### Simple example
4845
Here is an example of how you can use this module in your inventory structure:
4946
```hcl
50-
module "iam-role" {
47+
module "iam-role" {
5148
source = "clouddrove/iam-role/aws"
52-
version = "1.3.0"
53-
54-
name = "iam-role"
55-
application = "clouddrove"
56-
environment = "test"
57-
label_order = ["environment", "name"]
58-
assume_role_policy = data.aws_iam_policy_document.default.json
59-
managed_policy_arns =
60-
policy_enabled = true
61-
policy = data.aws_iam_policy_document.iam-policy.json
49+
name = local.name
50+
environment = local.environment
51+
assume_role_policy = data.aws_iam_policy_document.default.json
52+
policy_enabled = true
53+
policy = data.aws_iam_policy_document.iam-policy.json
6254
}
6355
64-
data "aws_iam_policy_document" "default" {
56+
##-----------------------------------------------------------------------------
57+
## Data block to create IAM policy.
58+
##-----------------------------------------------------------------------------
59+
data "aws_iam_policy_document" "default" {
6560
statement {
6661
effect = "Allow"
6762
actions = ["sts:AssumeRole"]
@@ -72,14 +67,17 @@ usage: |-
7267
}
7368
}
7469
75-
data "aws_iam_policy_document" "iam-policy" {
70+
##-----------------------------------------------------------------------------
71+
## Data block to create IAM policy.
72+
##-----------------------------------------------------------------------------
73+
data "aws_iam_policy_document" "iam-policy" {
7674
statement {
7775
actions = [
7876
"ssm:UpdateInstanceInformation",
7977
"ssmmessages:CreateControlChannel",
8078
"ssmmessages:CreateDataChannel",
8179
"ssmmessages:OpenControlChannel",
82-
"ssmmessages:OpenDataChannel" ]
80+
"ssmmessages:OpenDataChannel"]
8381
effect = "Allow"
8482
resources = ["*"]
8583
}

_example/complete/example.tf

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ provider "aws" {
22
region = "eu-west-1"
33
}
44

5+
locals {
6+
name = "role"
7+
environment = "test"
8+
}
9+
510
##-----------------------------------------------------------------------------
611
## IAM role module call.
712
##-----------------------------------------------------------------------------
813
module "iam-role" {
914
source = "./../../"
10-
name = "iam"
11-
environment = "test"
15+
name = local.name
16+
environment = local.environment
1217
assume_role_policy = data.aws_iam_policy_document.default.json
1318
policy_enabled = true
1419
policy = data.aws_iam_policy_document.iam-policy.json

_example/complete/outputs.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
output "name" {
2-
value = module.iam-role.*.name
2+
value = module.iam-role.name
33
description = "Name of the role."
44
}
55

66
output "arn" {
7-
value = module.iam-role.*.arn
7+
value = module.iam-role.arn
88
description = "The Amazon Resource Name (ARN) specifying the role."
99
}
1010

_example/complete/versions.tf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Terraform version
2+
terraform {
3+
required_version = ">= 1.6.1"
4+
5+
required_providers {
6+
aws = {
7+
source = "hashicorp/aws"
8+
version = ">= 5.20.1"
9+
}
10+
}
11+
}

_test/iam_role_test.go

-35
This file was deleted.

main.tf

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Managed By : CloudDrove
2-
# Copyright @ CloudDrove. All Right Reserved.
3-
4-
##-----------------------------------------------------------------------------
1+
##-----------------------------------------------------------------------------
52
## Labels module callled that will be used for naming and tags.
63
##-----------------------------------------------------------------------------
74
module "labels" {
@@ -38,7 +35,7 @@ resource "aws_iam_role" "default" {
3835
resource "aws_iam_role_policy" "default" {
3936
count = var.enabled && var.policy_enabled && var.policy_arn == "" ? 1 : 0
4037
name = format("%s-policy", module.labels.id)
41-
role = aws_iam_role.default.*.id[0]
38+
role = aws_iam_role.default[0].id
4239
policy = var.policy
4340
}
4441

@@ -47,6 +44,6 @@ resource "aws_iam_role_policy" "default" {
4744
##-----------------------------------------------------------------------------
4845
resource "aws_iam_role_policy_attachment" "default" {
4946
count = var.enabled && var.policy_enabled && var.policy_arn != "" ? 1 : 0
50-
role = aws_iam_role.default.*.id[0]
47+
role = aws_iam_role.default[0].id
5148
policy_arn = var.policy_arn
5249
}

outputs.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Module : Iam Role
22
# Description : Terraform module to create Iam Role resource on AWS.
33
output "arn" {
4-
value = join("", aws_iam_role.default.*.arn)
4+
value = aws_iam_role.default[0].arn
55
description = "The Amazon Resource Name (ARN) specifying the role."
66
}
77

@@ -11,16 +11,16 @@ output "tags" {
1111
}
1212

1313
output "name" {
14-
value = join("", aws_iam_role.default.*.name)
14+
value = aws_iam_role.default[0].name
1515
description = "Name of specifying the role."
1616
}
1717

1818
output "policy" {
19-
value = join("", aws_iam_role_policy.default.*.policy)
19+
value = aws_iam_role_policy.default[0].policy
2020
description = "The policy document attached to the role."
2121
}
2222

2323
output "role" {
24-
value = join("", aws_iam_role_policy.default.*.role)
24+
value = aws_iam_role_policy.default[0].role
2525
description = "The name of the role associated with the policy."
2626
}

0 commit comments

Comments
 (0)