-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.terraform-compliance.yaml
More file actions
144 lines (127 loc) · 4.6 KB
/
Copy path.terraform-compliance.yaml
File metadata and controls
144 lines (127 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
# Terraform Compliance Configuration
# This file defines compliance rules for the Terraform infrastructure
# Security Rules
security:
# EKS Cluster Security
- name: "EKS Cluster Security"
description: "Ensure EKS cluster has proper security configurations"
rules:
- name: "EKS Cluster Encryption"
description: "EKS cluster should have encryption enabled"
resource: "aws_eks_cluster"
property: "encryption_config"
condition: "should not be empty"
- name: "EKS Cluster Logging"
description: "EKS cluster should have logging enabled"
resource: "aws_eks_cluster"
property: "enabled_cluster_log_types"
condition: "should contain api"
- name: "EKS Cluster Version"
description: "EKS cluster should use supported version"
resource: "aws_eks_cluster"
property: "version"
condition: "should be greater than 1.24"
# VPC Security
- name: "VPC Security"
description: "Ensure VPC has proper security configurations"
rules:
- name: "VPC Flow Logs"
description: "VPC should have flow logs enabled"
resource: "aws_flow_log"
condition: "should exist"
- name: "VPC CIDR Block"
description: "VPC should use private CIDR blocks"
resource: "aws_vpc"
property: "cidr_block"
condition: >-
should match /^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)/
# IAM Security
- name: "IAM Security"
description: "Ensure IAM resources follow security best practices"
rules:
- name: "IAM Role Policies"
description: "IAM roles should have least privilege policies"
resource: "aws_iam_role_policy"
condition: "should exist"
- name: "IAM Role Names"
description: "IAM role names should follow naming convention"
resource: "aws_iam_role"
property: "name"
condition: "should match /^[a-zA-Z0-9_-]+$/"
# EFS Security
- name: "EFS Security"
description: "Ensure EFS has proper security configurations"
rules:
- name: "EFS Encryption"
description: "EFS should have encryption enabled"
resource: "aws_efs_file_system"
property: "encrypted"
condition: "should be true"
- name: "EFS Security Groups"
description: "EFS should have security groups configured"
resource: "aws_efs_mount_target"
condition: "should exist"
# SQS Security
- name: "SQS Security"
description: "Ensure SQS queues have proper security configurations"
rules:
- name: "SQS Encryption"
description: "SQS queues should have encryption enabled"
resource: "aws_sqs_queue"
property: "kms_master_key_id"
condition: "should not be empty"
# Compliance Rules
compliance:
# Tagging Standards
- name: "Tagging Standards"
description: "Ensure all resources have proper tags"
rules:
- name: "Required Tags"
description: "All resources should have required tags"
resource: "*"
property: "tags"
condition: "should contain Environment"
- name: "Tag Format"
description: "Tags should follow proper format"
resource: "*"
property: "tags"
condition: "should match /^[a-zA-Z0-9_-]+$/"
# Naming Conventions
- name: "Naming Conventions"
description: "Ensure resources follow naming conventions"
rules:
- name: "Resource Names"
description: "Resource names should follow naming convention"
resource: "*"
property: "name"
condition: "should match /^[a-z0-9-]+$/"
# Cost Optimization
cost:
- name: "Cost Optimization"
description: "Ensure cost-effective resource configurations"
rules:
- name: "Instance Types"
description: "Use cost-effective instance types"
resource: "aws_eks_node_group"
property: "instance_types"
condition: "should not contain t2.micro"
- name: "Storage Classes"
description: "Use appropriate storage classes"
resource: "aws_efs_file_system"
property: "performance_mode"
condition: "should be generalPurpose"
# GovCloud Specific Rules
govcloud:
- name: "GovCloud Compliance"
description: "Ensure GovCloud specific requirements are met"
rules:
- name: "ECR Repositories"
description: "All container images should use ECR"
resource: "aws_ecr_repository"
condition: "should exist"
- name: "No Public Resources"
description: "No resources should be publicly accessible"
resource: "*"
property: "publicly_accessible"
condition: "should be false"