File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed
Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 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/
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments