Skip to content

Commit cd4f3f4

Browse files
Manifest and code changes for release
1 parent 3a52aa2 commit cd4f3f4

21 files changed

+140
-158
lines changed

.gitignore

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1-
*.tfstate
2-
*.tfstate.*
3-
.terraform*
1+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
42
*.out
53
*.lock
64
*.tfvars
75
*.pem
8-
vars
6+
*.txt
7+
8+
# Local .terraform directories
99
**/.terraform/*
10+
.terraform*
11+
12+
# .tfstate files
13+
*.tfstate
14+
*.tfstate.*
15+
16+
# Crash log files
17+
crash.log
18+
crash.*.log
19+
20+
*.tfvars
21+
*.tfvars.json
22+
23+
# Ignore override files as they are usually used to override resources locally and so
24+
# are not checked in
1025
override.tf
11-
override.tf.*
26+
override.tf.json
1227
*_override.tf
13-
*_override.tf.*
28+
*_override.tf.json
29+
30+
# Ignore CLI configuration files
31+
.terraformrc
1432
terraform.rc
15-
*.txt

.pre-commit-config.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
repos:
2-
- repo: https://github.com/squareops/pre-commit
3-
rev: v0.1.12
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.1.0
44
hooks:
5-
- id: terraform-fmt
6-
- id: terraform-validate
7-
- id: tflint
8-
args:
9-
# - "--module"
10-
- "--config=.tflint.hcl"
5+
- id: trailing-whitespace
6+
args: ['--markdown-linebreak-ext=md']
7+
- id: end-of-file-fixer
8+
- id: check-merge-conflict
9+
- id: detect-private-key
10+
- id: detect-aws-credentials
11+
args: ['--allow-missing-credentials']
1112
- repo: https://github.com/antonbabenko/pre-commit-terraform
12-
rev: v1.74.0
13+
rev: v1.77.0
1314
hooks:
15+
- id: terraform_fmt
1416
- id: terraform_docs
1517
args:
16-
- --hook-config=--add-to-existing-file=true
17-
- --hook-config=--create-file-if-not-exist=true
18-
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.1.0
20-
hooks:
21-
- id: check-merge-conflict
22-
- id: end-of-file-fixer
18+
- '--args=--lockfile=false'
19+
- id: terraform_tflint
20+
args:
21+
- --args=--config=.tflint.hcl
22+
- id: terraform_tfsec
23+
files: ^examples/ # only scan `examples/*` which are the implementation
24+
args:
25+
- --args=--config-file=__GIT_WORKING_DIR__/tfsec.yaml
26+
- --args=--concise-output

.tflint.hcl

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
plugin "aws" {
22
enabled = true
3-
version = "0.14.0"
3+
version = "0.21.1"
44
source = "github.com/terraform-linters/tflint-ruleset-aws"
55
}
6-
76
config {
87
#Enables module inspection
9-
module = true
8+
module = false
109
force = false
1110
}
12-
1311
# Required that all AWS resources have specified tags.
1412
rule "aws_resource_missing_tags" {
1513
enabled = true
@@ -18,95 +16,75 @@ rule "aws_resource_missing_tags" {
1816
"Environment",
1917
]
2018
}
21-
2219
# Disallow deprecated (0.11-style) interpolation
2320
rule "terraform_deprecated_interpolation" {
24-
enabled = true
21+
enabled = true
2522
}
26-
2723
# Disallow legacy dot index syntax.
2824
rule "terraform_deprecated_index" {
29-
enabled = true
25+
enabled = true
3026
}
31-
3227
# Disallow variables, data sources, and locals that are declared but never used.
3328
rule "terraform_unused_declarations" {
34-
enabled = true
29+
enabled = true
3530
}
36-
3731
# Disallow // comments in favor of #.
3832
rule "terraform_comment_syntax" {
39-
enabled = false
33+
enabled = false
4034
}
41-
4235
# Disallow output declarations without description.
4336
rule "terraform_documented_outputs" {
44-
enabled = true
37+
enabled = true
4538
}
46-
4739
# Disallow variable declarations without description.
4840
rule "terraform_documented_variables" {
49-
enabled = true
41+
enabled = true
5042
}
51-
5243
# Disallow variable declarations without type.
5344
rule "terraform_typed_variables" {
54-
enabled = true
45+
enabled = true
5546
}
56-
5747
# Disallow specifying a git or mercurial repository as a module source without pinning to a version.
5848
rule "terraform_module_pinned_source" {
59-
enabled = true
49+
enabled = true
6050
}
61-
6251
# Enforces naming conventions
6352
rule "terraform_naming_convention" {
64-
enabled = true
65-
53+
enabled = true
6654
#Require specific naming structure
6755
variable {
68-
format = "snake_case"
56+
format = "snake_case"
6957
}
70-
7158
locals {
72-
format = "snake_case"
59+
format = "snake_case"
7360
}
74-
7561
output {
76-
format = "snake_case"
62+
format = "snake_case"
7763
}
78-
7964
#Allow any format
8065
resource {
81-
format = "none"
66+
format = "none"
8267
}
83-
8468
module {
85-
format = "none"
69+
format = "none"
8670
}
87-
8871
data {
89-
format = "none"
72+
format = "none"
9073
}
91-
9274
}
93-
9475
# Disallow terraform declarations without require_version.
9576
rule "terraform_required_version" {
96-
enabled = true
77+
enabled = true
9778
}
98-
9979
# Require that all providers have version constraints through required_providers.
10080
rule "terraform_required_providers" {
101-
enabled = true
81+
enabled = true
10282
}
103-
10483
# Ensure that a module complies with the Terraform Standard Module Structure
10584
rule "terraform_standard_module_structure" {
106-
enabled = true
85+
enabled = true
10786
}
108-
10987
# terraform.workspace should not be used with a "remote" backend with remote execution.
11088
rule "terraform_workspace_remote" {
111-
enabled = true
89+
enabled = true
11290
}

IAM.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
## IAM Permission
33

4-
<!-- BEGINNING OF PRE-COMMIT-PIKE DOCS HOOK -->
54
The Policy required to deploy this module is:
65

76
```json
@@ -200,4 +199,3 @@ The Policy required to deploy this module is:
200199
}
201200

202201
```
203-
<!-- END OF PRE-COMMIT-PIKE DOCS HOOK -->

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2023 SquareOps Technologies Pvt. Ltd.
189+
Copyright 2023 SquareOps Technologies Pvt. Ltd.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,28 @@
33

44
![squareops_avatar]
55

6-
[squareops_avatar]: https://squareops.com/img/home1/Squareops_logo.jpg
6+
[squareops_avatar]: https://squareops.com/wp-content/uploads/2022/12/squareops-logo.png
77

88
### [SquareOps Technologies](https://squareops.com/) Provide end to end solution for all your DevOps needs
99

1010
<br>
1111

12-
1312
Terraform module to create Networking resources for workload deployment on AWS Cloud.
1413

15-
<br>
16-
1714
## Usage Example
1815

1916
```hcl
2017
2118
module "key_pair_vpn" {
22-
source = "squareops/terraform-aws-ec2-keypair"
23-
region = us-east-1
24-
environment = production
25-
key_name = format("%s-%s-vpn", production, skaf)
26-
ssm_parameter_path = format("%s-%s-vpn", production, skaf)
19+
source = "squareops/keypair/aws"
20+
environment = "production"
21+
key_name = format("%s-%s-vpn", "production", "skaf")
22+
ssm_parameter_path = format("%s-%s-vpn", "production", "skaf")
2723
}
2824
2925
3026
module "vpc" {
31-
source = "squareops/terraform-aws-network"
27+
source = "squareops/vpc/aws"
3228
3329
environment = "production"
3430
name = "skaf"
@@ -48,13 +44,13 @@ module "vpc" {
4844
flow_log_cloudwatch_log_group_retention_in_days = 90
4945
5046
}
51-
52-
5347
```
5448
Refer [examples](examples) for all examples.
5549

5650
## Important Note
57-
To prevent destruction interruptions, any resources that have been created outside of Terraform and attached to the resources provisioned by Terraform must be deleted before the module is destroyed.
51+
To prevent destruction interruptions, any resources that have been created outside of Terraform and attached to the resources provisioned by Terraform must be deleted before the module is destroyed.
52+
53+
The private key generated by Keypair module will be stored in AWS Systems Manager Parameter Store. FOr more details refer [this](https://registry.terraform.io/modules/squareops/keypair/aws)
5854

5955
## Network Scenarios
6056

@@ -70,7 +66,7 @@ This module supports three scenarios to create Network resource on AWS. Each wil
7066
- `enable_public_subnet = true`
7167
- `enable_private_subnet = true`
7268

73-
- **complete-vpc-with-vpn:** To create a VPC with public, private, database and intra subnets along with an IGW and NAT gateway. Jump server/Bastion Host is also configured.
69+
- **complete-vpc-with-vpn:** To create a VPC with public, private, database and intra subnets along with an IGW and NAT gateway. Jump server/Bastion Host is also configured.
7470
- `vpc_cidr = local.vpc_cidr`
7571
- `enable_public_subnet = true`
7672
- `enable_private_subnet = true`
@@ -94,32 +90,32 @@ The required IAM permissions to create resources from this module can be found [
9490

9591
To configure Pritunl VPN:
9692

97-
1. Access the Pritunl UI using the public IP of EC2 instance in browser
98-
2. Get the initial key, user and password for setting up Pritunl from Secret Manager and log in to Pritunl.
93+
1. Access the Pritunl UI over HTTPS using the public IP of EC2 instance in browser
94+
2. Retrieve the initial key, user and password for setting up Pritunl from AWS Secrets Manager and log in to Pritunl.
9995
3. Create a DNS record mapping to the EC2 instance's public IP
10096
4. After login, in the Initial setup window, add the record created in the 'Lets Encrypt Domain' field.
10197
5. Pritunl will automatically configure a signed SSL certificate from Lets Encrypt.
10298
6. Add organization and user to pritunl.
10399
7. Set server port as 10150 which is already allowed from security group while creating vpn.
104100
8. Attach organization to the server and Start the server.
105-
9. Copy or download user profile link or file.
101+
9. Copy or download user profile link or file.
106102
10. Import the profile in Pritunl client.
107-
103+
108104
NOTE: Port 80 should be open publicly in the vpn security group to verify and renewing the domain certificate.
109105

110-
# CIS COMPLIANCE
106+
# CIS COMPLIANCE
111107

112-
- Follows the VPC recommendations of CIS Amazon Web Services Foundations Benchmark v1.4.0
108+
- Follows the VPC recommendations of CIS Amazon Web Services Foundations Benchmark v1.4.0
113109

114110
[ 5. NETWORKING ]
115111

116-
5.1 Ensure no Network ACLs allow ingress from 0.0.0.0/0 to remote
112+
5.1 Ensure no Network ACLs allow ingress from 0.0.0.0/0 to remote
117113
server administration ports (Automated)
118114

119-
5.2 Ensure no security groups allow ingress from 0.0.0.0/0 to remote
115+
5.2 Ensure no security groups allow ingress from 0.0.0.0/0 to remote
120116
server administration ports (Automated)
121117

122-
5.3 Ensure the default security group of every VPC restricts all traffic
118+
5.3 Ensure the default security group of every VPC restricts all traffic
123119
(Automated)
124120

125121

@@ -135,7 +131,7 @@ server administration ports (Automated)
135131

136132
| Name | Version |
137133
|------|---------|
138-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.31.0 |
134+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.23 |
139135

140136
## Modules
141137

@@ -154,7 +150,7 @@ server administration ports (Automated)
154150

155151
| Name | Description | Type | Default | Required |
156152
|------|-------------|------|---------|:--------:|
157-
| <a name="input_azs"></a> [azs](#input\_azs) | List of Availability Zone to be used by VPC | `list(any)` | `[]` | no |
153+
| <a name="input_azs"></a> [azs](#input\_azs) | List of Availability Zone to be used by VPC | `list(any)` | n/a | yes |
158154
| <a name="input_database_subnet_cidrs"></a> [database\_subnet\_cidrs](#input\_database\_subnet\_cidrs) | Database Tier subnet CIDRs to be created | `list(any)` | `[]` | no |
159155
| <a name="input_default_network_acl_ingress"></a> [default\_network\_acl\_ingress](#input\_default\_network\_acl\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <pre>[<br> {<br> "action": "deny",<br> "cidr_block": "0.0.0.0/0",<br> "from_port": 22,<br> "protocol": "tcp",<br> "rule_no": 98,<br> "to_port": 22<br> },<br> {<br> "action": "deny",<br> "cidr_block": "0.0.0.0/0",<br> "from_port": 3389,<br> "protocol": "tcp",<br> "rule_no": 99,<br> "to_port": 3389<br> },<br> {<br> "action": "allow",<br> "cidr_block": "0.0.0.0/0",<br> "from_port": 0,<br> "protocol": "-1",<br> "rule_no": 100,<br> "to_port": 0<br> },<br> {<br> "action": "allow",<br> "from_port": 0,<br> "ipv6_cidr_block": "::/0",<br> "protocol": "-1",<br> "rule_no": 101,<br> "to_port": 0<br> }<br>]</pre> | no |
160156
| <a name="input_enable_database_subnet"></a> [enable\_database\_subnet](#input\_enable\_database\_subnet) | Set true to enable database subnets | `bool` | `false` | no |
@@ -170,7 +166,6 @@ server administration ports (Automated)
170166
| <a name="input_one_nat_gateway_per_az"></a> [one\_nat\_gateway\_per\_az](#input\_one\_nat\_gateway\_per\_az) | Set to true if a NAT Gateway is required per availability zone for Private Subnet Tier | `bool` | `false` | no |
171167
| <a name="input_private_subnet_cidrs"></a> [private\_subnet\_cidrs](#input\_private\_subnet\_cidrs) | A list of private subnets CIDR to be created inside the VPC | `list(any)` | `[]` | no |
172168
| <a name="input_public_subnet_cidrs"></a> [public\_subnet\_cidrs](#input\_public\_subnet\_cidrs) | A list of public subnets CIDR to be created inside the VPC | `list(any)` | `[]` | no |
173-
| <a name="input_region"></a> [region](#input\_region) | Specify the region in which VPC will be created | `string` | `"us-east-1"` | no |
174169
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | The CIDR block of the VPC | `string` | `"10.0.0.0/16"` | no |
175170
| <a name="input_vpn_key_pair"></a> [vpn\_key\_pair](#input\_vpn\_key\_pair) | Specify the name of AWS Keypair to be used for VPN Server | `string` | `""` | no |
176171
| <a name="input_vpn_server_enabled"></a> [vpn\_server\_enabled](#input\_vpn\_server\_enabled) | Set to true if you want to deploy VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |
@@ -181,15 +176,11 @@ server administration ports (Automated)
181176
| Name | Description |
182177
|------|-------------|
183178
| <a name="output_database_subnets"></a> [database\_subnets](#output\_database\_subnets) | List of IDs of database subnets |
184-
| <a name="output_intra_subnets"></a> [intra\_subnets](#output\_intra\_subnets) | Intra Subnet IDs |
179+
| <a name="output_intra_subnets"></a> [intra\_subnets](#output\_intra\_subnets) | List of IDs of Intra subnets |
185180
| <a name="output_private_subnets"></a> [private\_subnets](#output\_private\_subnets) | List of IDs of private subnets |
186181
| <a name="output_public_subnets"></a> [public\_subnets](#output\_public\_subnets) | List of IDs of public subnets |
187-
| <a name="output_region"></a> [region](#output\_region) | AWS Region for the VPC |
188182
| <a name="output_vpc_cidr_block"></a> [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | IPV4 CIDR Block for this VPC |
189183
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | The ID of the VPC |
190184
| <a name="output_vpn_host_public_ip"></a> [vpn\_host\_public\_ip](#output\_vpn\_host\_public\_ip) | IP Address of VPN Server |
191185
| <a name="output_vpn_security_group"></a> [vpn\_security\_group](#output\_vpn\_security\_group) | Security Group ID of VPN Server |
192186
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
193-
194-
195-

0 commit comments

Comments
 (0)