Skip to content

Commit b2f6c77

Browse files
author
rahul-infra
committed
made changes in github actions
1 parent 30152e8 commit b2f6c77

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

.github/workflows/terraform-checks.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ jobs:
1212
name: Test
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
20+
1521
- name: Setup Terraform
1622
uses: hashicorp/setup-terraform@v3
1723
with:
@@ -55,6 +61,9 @@ jobs:
5561
steps:
5662
- name: Checkout
5763
uses: actions/checkout@v5
64+
with:
65+
fetch-depth: 0
66+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
5867

5968
- name: Get root directories
6069
id: dirs
@@ -67,8 +76,8 @@ jobs:
6776
strategy:
6877
matrix:
6978
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
79+
7080
steps:
71-
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
7281
- name: Delete huge unnecessary tools folder
7382
run: |
7483
rm -rf /opt/hostedtoolcache/CodeQL
@@ -78,24 +87,25 @@ jobs:
7887
7988
- name: Checkout
8089
uses: actions/checkout@v5
90+
with:
91+
fetch-depth: 0
92+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
8193

8294
- name: Terraform min/max versions
8395
id: minMax
8496
uses: clowdhaus/[email protected]
8597
with:
8698
directory: ${{ matrix.directory }}
8799
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
88-
# Run only validate pre-commit check on min version supported
89-
if: ${{ matrix.directory != '.' }}
100+
if: ${{ matrix.directory != '.' }}
90101
uses: clowdhaus/terraform-composite-actions/[email protected]
91102
with:
92103
terraform-version: ${{ steps.minMax.outputs.minVersion }}
93104
tflint-version: ${{ env.TFLINT_VERSION }}
94105
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
95106

96107
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
97-
# Run only validate pre-commit check on min version supported
98-
if: ${{ matrix.directory == '.' }}
108+
if: ${{ matrix.directory == '.' }}
99109
uses: clowdhaus/terraform-composite-actions/[email protected]
100110
with:
101111
terraform-version: ${{ steps.minMax.outputs.minVersion }}
@@ -107,7 +117,6 @@ jobs:
107117
runs-on: ubuntu-latest
108118
needs: collectInputs
109119
steps:
110-
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
111120
- name: Delete huge unnecessary tools folder
112121
run: |
113122
rm -rf /opt/hostedtoolcache/CodeQL
@@ -118,8 +127,8 @@ jobs:
118127
- name: Checkout
119128
uses: actions/checkout@v5
120129
with:
121-
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
122-
token: ${{ secrets.GITHUB_TOKEN }}
130+
fetch-depth: 0
131+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
123132

124133
- name: Terraform min/max versions
125134
id: minMax

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ repos:
1414
- '--args=--only=terraform_typed_variables'
1515
- '--args=--only=terraform_module_pinned_source'
1616
- '--args=--only=terraform_naming_convention'
17+
- '--args=--only=terraform_required_version'
18+
- '--args=--only=terraform_required_providers'
1719
- '--args=--only=terraform_standard_module_structure'
1820
- '--args=--only=terraform_workspace_remote'
21+
- '--args=--only=terraform_unused_required_providers'
1922
- id: terraform_validate
2023
args:
2124
- --hook-config=--retry-once-with-cleanup=true

main.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ data "aws_ssm_parameter" "rds" {
1515
module "postgres_security_group" {
1616
source = "terraform-aws-modules/security-group/aws"
1717
version = "~> 5.3.0"
18-
providers = {
19-
aws = aws
20-
}
21-
2218

2319
name = local.rds.sg_name
2420
description = local.rds.sg_description
@@ -49,9 +45,6 @@ module "postgres_security_group" {
4945
module "kong_rds" {
5046
source = "terraform-aws-modules/rds/aws"
5147
version = "~> 6.13.0"
52-
providers = {
53-
aws = aws
54-
}
5548

5649
identifier = local.rds.db_identifier
5750
engine = local.rds.engine
@@ -93,9 +86,6 @@ module "kong_rds" {
9386
module "internal_alb_security_group" {
9487
source = "terraform-aws-modules/security-group/aws"
9588
version = "~> 5.3.0"
96-
providers = {
97-
aws = aws
98-
}
9989

10090
name = local.kong.alb_sg_name
10191
vpc_id = var.vpc_id
@@ -123,9 +113,6 @@ module "internal_alb_security_group" {
123113
module "public_alb_security_group" {
124114
source = "terraform-aws-modules/security-group/aws"
125115
version = "~> 5.3.0"
126-
providers = {
127-
aws = aws
128-
}
129116

130117
name = local.kong.alb_sg_name
131118
vpc_id = var.vpc_id
@@ -156,9 +143,6 @@ module "public_alb_security_group" {
156143
module "ecs_task_security_group" {
157144
source = "terraform-aws-modules/security-group/aws"
158145
version = "~> 5.3.0"
159-
providers = {
160-
aws = aws
161-
}
162146

163147
name = local.kong.ecs_task_sg_name
164148
vpc_id = var.vpc_id

0 commit comments

Comments
 (0)