Skip to content

Commit 05592da

Browse files
authored
Merge pull request #38 from Aswin-Vijayan/TEC-56
[TEC-56][Added] - VPC Endpoints and NACL
2 parents 27dfe4d + 9451794 commit 05592da

File tree

30 files changed

+1698
-86
lines changed

30 files changed

+1698
-86
lines changed

environments/dev/backend/dynamodb.tf renamed to environments/dev/backend/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
provider "aws" {
2+
region = "us-west-2"
3+
}
4+
5+
resource "aws_s3_bucket" "state_lock_bucket" {
6+
bucket = "${var.environment}-${var.application}-s3-bucket"
7+
8+
tags = merge(
9+
{
10+
Name = "${var.environment}-${var.application}-s3-bucket"
11+
Environment = var.environment,
12+
Owner = var.owner,
13+
CostCenter = var.cost_center,
14+
Application = var.application
15+
},
16+
var.tags
17+
)
18+
}
19+
120
resource "aws_dynamodb_table" "state_lock_table" {
221
name = "${var.environment}-${var.application}-dynamodb-table"
322
billing_mode = var.billing_mode

environments/dev/backend/s3.tf

Lines changed: 0 additions & 18 deletions
This file was deleted.

environments/dev/ec2/main.tf

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ provider "aws" {
22
region = var.region
33
}
44

5+
module "iam-policy" {
6+
source = "../../../modules/iam-policy"
7+
iam_policy_json_file = var.iam_policy_json_file
8+
owner = var.owner
9+
environment = var.environment
10+
cost_center = var.cost_center
11+
application = var.application
12+
}
13+
514
module "ec2" {
615
source = "../../../modules/ec2"
716
region = var.region
@@ -10,23 +19,22 @@ module "ec2" {
1019
key_name = var.key_name
1120
instance_count = var.instance_count
1221
subnet_ids = var.subnet_ids
13-
name = var.name
22+
associate_public_ip_address = var.associate_public_ip_address
23+
attach_instance_profile = var.attach_instance_profile
24+
iam_role = module.iam-policy.iam_role
25+
security_group_ids = module.security-group.security_group_ids
26+
attach_eip = var.attach_eip
27+
storage_size = var.storage_size
1428
environment = var.environment
1529
owner = var.owner
1630
cost_center = var.cost_center
1731
application = var.application
18-
security_group_ids = module.security-group.security_group_ids
32+
1933
}
2034

2135
module "security-group" {
2236
source = "../../../modules/security-group"
2337
region = var.region
24-
tags = var.tags
25-
name = var.name
26-
environment = var.environment
27-
owner = var.owner
28-
cost_center = var.cost_center
29-
application = var.application
3038
vpc_id = var.vpc_id
3139

3240
ingress_cidr_from_port = var.ingress_cidr_from_port
@@ -49,5 +57,11 @@ module "security-group" {
4957
egress_sg_protocol = var.egress_sg_protocol
5058
egress_security_group_ids = var.egress_security_group_ids
5159
create_egress_sg = var.create_egress_sg
60+
61+
environment = var.environment
62+
owner = var.owner
63+
cost_center = var.cost_center
64+
application = var.application
5265
}
5366

67+

environments/dev/ec2/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ output "instance_public_ip" {
1313
value = module.ec2.instance_public_ip
1414
}
1515

16+
output "instance_eip" {
17+
description = "EIP attach to the ec2 instance"
18+
value = module.ec2.instance_eip
19+
}

environments/dev/ec2/variables.tf

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,37 @@ variable "vpc_id" {
3333
description = "VPC ID for the security group"
3434
}
3535

36+
variable "associate_public_ip_address" {
37+
type = bool
38+
description = "Enable or disable public ip address"
39+
}
40+
41+
variable "attach_instance_profile" {
42+
type = bool
43+
description = "Attach instance profile or not"
44+
}
45+
46+
variable "iam_policy_json_file" {
47+
type = string
48+
description = "Name of the json file"
49+
}
50+
51+
variable "attach_eip" {
52+
type = bool
53+
description = "Attach eip or not"
54+
}
55+
56+
variable "storage_size" {
57+
type = number
58+
description = "Storage size of the instance"
59+
}
60+
3661
variable "tags" {
3762
default = {}
3863
type = map(string)
3964
description = "Extra tags to attach to the security group resources"
4065
}
4166

42-
variable "name" {
43-
type = string
44-
description = "The name of the resources"
45-
}
46-
4767
variable "environment" {
4868
type = string
4969
description = "The environment name for the resources"
@@ -163,3 +183,9 @@ variable "create_egress_sg" {
163183
type = bool
164184
description = "Enable or disable Security Groups egress rules."
165185
}
186+
187+
variable "iam_role" {
188+
default = null
189+
description = "IAM role for the instance"
190+
type = string
191+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Action": "*",
7+
"Resource": "*"
8+
}
9+
]
10+
}

environments/dev/ses/main.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
provider "aws" {
2+
region = var.region
3+
}
4+
5+
module "ses" {
6+
source = "../../modules/ses"
7+
region = var.region
8+
domain_name = var.domain_name
9+
dkim_record_count = var.dkim_record_count
10+
zone_id = var.zone_id
11+
dkim_record_type = var.dkim_record_type
12+
dkim_ttl = var.dkim_ttl
13+
custom_mail = var.custom_mail
14+
spf_mx_record = var.spf_mx_record
15+
spf_txt_record = var.spf_txt_record
16+
spf_ttl = var.spf_ttl
17+
name = var.name
18+
environment = var.environment
19+
owner = var.owner
20+
cost_center = var.cost_center
21+
application = var.application
22+
}
23+
24+

environments/dev/ses/output.tf

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
output "domain_identity_token" {
2+
description = "Domain identity tokens"
3+
value = module.ses.domain_identity_token
4+
}
5+
6+
output "domain_verification" {
7+
description = "Verification status of the domain identity"
8+
value = module.ses.domain_verification
9+
}
10+
11+
output "dkim_tokens" {
12+
description = "DKIM tokens for domain identity"
13+
value = module.ses.dkim_tokens
14+
}
15+
16+
output "domain_mail" {
17+
description = "Email address associated with the domain identity"
18+
value = module.ses.domain_mail
19+
}
20+
21+
output "route53_dkim_fqdn" {
22+
description = "FQDN for the Route 53 DKIM DNS record"
23+
value = module.ses.route53_dkim_fqdn
24+
}
25+
26+
output "route53_spf_mx_fqdn" {
27+
description = "FQDN for the Route 53 SPF MX DNS record"
28+
value = module.ses.route53_spf_mx_fqdn
29+
}
30+
31+
output "route53_spf_txt_fqdn" {
32+
description = "FQDN for the Route 53 SPF TXT DNS record"
33+
value = module.ses.route53_spf_txt_fqdn
34+
}
35+
36+
output "iam_user_name" {
37+
description = "IAM user name associated with SES"
38+
value = module.ses.iam_user_name
39+
}
40+
41+
output "iam_user_policy" {
42+
description = "IAM policy associated with the IAM user"
43+
value = module.ses.iam_user_policy
44+
}
45+

environments/dev/ses/variables.tf

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
variable "region" {
2+
type = string
3+
description = "Region of the EC2 instance"
4+
}
5+
6+
variable "domain_name" {
7+
type = string
8+
description = "Name of the domain"
9+
}
10+
11+
variable "dkim_record_count" {
12+
type = number
13+
description = "Number of DKIM records to create"
14+
}
15+
16+
variable "zone_id" {
17+
type = string
18+
description = "ID of the DNS zone where records will be added"
19+
}
20+
21+
variable "dkim_record_type" {
22+
type = string
23+
description = "Type of DKIM records to create"
24+
}
25+
26+
variable "dkim_ttl" {
27+
type = number
28+
description = "Time To Live (TTL) for DKIM records"
29+
}
30+
31+
variable "custom_mail" {
32+
type = string
33+
description = "Custom email address to associate with the domain"
34+
}
35+
36+
variable "spf_mx_record" {
37+
type = string
38+
description = "SPF MX record value for domain"
39+
}
40+
41+
variable "spf_txt_record" {
42+
type = string
43+
description = "SPF TXT record value for domain"
44+
}
45+
46+
variable "spf_ttl" {
47+
type = number
48+
description = "Time To Live (TTL) for SPF records"
49+
}
50+
51+
variable "tags" {
52+
default = {}
53+
type = map(string)
54+
description = "Tags to associate with the resources"
55+
}
56+
57+
variable "name" {
58+
type = string
59+
description = "Name of the resource"
60+
}
61+
62+
variable "environment" {
63+
type = string
64+
description = "Environment where the resource is deployed"
65+
}
66+
67+
variable "owner" {
68+
type = string
69+
description = "Owner of the resource"
70+
}
71+
72+
variable "cost_center" {
73+
type = string
74+
description = "Cost center responsible for the resource"
75+
}
76+
77+
variable "application" {
78+
type = string
79+
description = "Application to which the resource belongs"
80+
}

0 commit comments

Comments
 (0)