Skip to content

Commit 9d06385

Browse files
MukeshMukesh
authored andcommitted
update
1 parent 335217b commit 9d06385

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/tflint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: TFLint Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
tflint:
11+
name: Run TFLint
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install TFLint
19+
run: |
20+
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
21+
22+
- name: Initialize TFLint
23+
run: tflint --init
24+
25+
- name: Run TFLint on All Modules
26+
run: tflint --config .tflint.hcl --recursive modules/

.tflint.hcl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugin "aws" {
2+
enabled = true
3+
version = "latest"
4+
}
5+
6+
# Enable built-in AWS rules
7+
rule "aws_instance_invalid_type" {
8+
enabled = true
9+
}
10+
11+
rule "aws_security_group_ingress_cidr_blocks" {
12+
enabled = true
13+
}
14+
15+
# Custom rule: Ensure S3 Buckets are private
16+
rule "aws_s3_bucket_private" {
17+
enabled = true
18+
}
19+
20+
# Custom rule: Ensure tags are always defined
21+
rule "terraform_module_tag_required" {
22+
enabled = true
23+
required_tags = ["Name", "Environment", "Owner"]
24+
}
25+
26+
# Custom rule: Prevent usage of sensitive IAM actions
27+
rule "aws_iam_policy_restricted_actions" {
28+
enabled = true
29+
restricted_actions = [
30+
"iam:*", # Prevent wildcard permissions
31+
"s3:*", # Prevent full S3 access
32+
"ec2:*" # Prevent full EC2 access
33+
]
34+
}

0 commit comments

Comments
 (0)