@@ -2,111 +2,134 @@ provider "aws" {
2
2
region = " eu-west-1"
3
3
}
4
4
5
- module "keypair" {
6
- source = " git::https://github.com/clouddrove/terraform-aws-keypair.git?ref=tags/0.12.2"
7
-
8
- key_path = " ~/.ssh/id_rsa.pub"
9
- key_name = " main-key"
10
- enable_key_pair = true
11
- }
12
5
13
6
module "vpc" {
14
7
source = " git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.4"
15
8
16
9
name = " vpc"
17
10
application = " clouddrove"
18
11
environment = " test"
19
- label_order = [" environment" , " name " , " application " ]
12
+ label_order = [" environment" , " application " , " name " ]
20
13
21
14
cidr_block = " 172.16.0.0/16"
22
15
}
23
16
24
17
module "public_subnets" {
25
- source = " git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.3 "
18
+ source = " git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.4 "
26
19
27
20
name = " public-subnet"
28
21
application = " clouddrove"
29
22
environment = " test"
30
- label_order = [" environment" , " name " , " application " ]
23
+ label_order = [" environment" , " application " , " name " ]
31
24
32
- availability_zones = [" eu-west-1a " , " eu-west-1c" ]
25
+ availability_zones = [" eu-west-1b " , " eu-west-1c" ]
33
26
vpc_id = module. vpc . vpc_id
34
27
cidr_block = module. vpc . vpc_cidr_block
35
28
type = " public"
36
29
igw_id = module. vpc . igw_id
37
30
}
38
31
39
32
module "http-https" {
40
- source = " git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.2"
33
+ source = " git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.3"
34
+
41
35
name = " http-https"
42
36
application = " clouddrove"
43
- label_order = [" environment" , " name" , " application" ]
37
+ environment = " test"
38
+ label_order = [" environment" , " application" , " name" ]
44
39
45
- environment = " test"
46
40
vpc_id = module. vpc . vpc_id
47
41
allowed_ip = [" 0.0.0.0/0" ]
48
42
allowed_ports = [80 , 443 ]
49
43
}
50
44
51
45
module "ssh" {
52
- source = " git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.2"
46
+ source = " git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.3"
47
+
53
48
name = " ssh"
54
49
application = " clouddrove"
55
- label_order = [" environment" , " name" , " application" ]
50
+ environment = " test"
51
+ label_order = [" environment" , " application" , " name" ]
56
52
57
- environment = " test"
58
53
vpc_id = module. vpc . vpc_id
59
54
allowed_ip = [module . vpc . vpc_cidr_block ]
60
55
allowed_ports = [22 ]
61
56
}
62
57
58
+ module "iam-role" {
59
+ source = " git::https://github.com/clouddrove/terraform-aws-iam-role.git?ref=tags/0.12.1"
60
+
61
+ name = " iam-role"
62
+ application = " clouddrove"
63
+ environment = " test"
64
+ label_order = [" environment" , " application" , " name" ]
65
+ assume_role_policy = data. aws_iam_policy_document . default . json
66
+
67
+ policy_enabled = true
68
+ policy = data. aws_iam_policy_document . iam-policy . json
69
+ }
70
+
71
+ data "aws_iam_policy_document" "default" {
72
+ statement {
73
+ effect = " Allow"
74
+ actions = [" sts:AssumeRole" ]
75
+ principals {
76
+ type = " Service"
77
+ identifiers = [" ec2.amazonaws.com" ]
78
+ }
79
+ }
80
+ }
81
+
82
+ data "aws_iam_policy_document" "iam-policy" {
83
+ statement {
84
+ actions = [
85
+ " ssm:UpdateInstanceInformation" ,
86
+ " ssmmessages:CreateControlChannel" ,
87
+ " ssmmessages:CreateDataChannel" ,
88
+ " ssmmessages:OpenControlChannel" ,
89
+ " ssmmessages:OpenDataChannel" ]
90
+ effect = " Allow"
91
+ resources = [" *" ]
92
+ }
93
+ }
94
+
63
95
module "ec2" {
64
- source = " git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3 "
96
+ source = " git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.4 "
65
97
66
98
name = " ec2-instance"
67
99
application = " clouddrove"
68
100
environment = " test"
69
- label_order = [" environment" , " name" , " application" ]
70
-
71
- instance_count = 2
72
- ami = " ami-08d658f84a6d84a80"
73
- ebs_optimized = false
74
- instance_type = " t2.nano"
75
- key_name = module. keypair . name
76
- monitoring = false
77
- associate_public_ip_address = true
78
- tenancy = " default"
79
- disk_size = 8
101
+ label_order = [" environment" , " application" , " name" ]
102
+
103
+ instance_count = 2
104
+ ami = " ami-08d658f84a6d84a80"
105
+ instance_type = " t2.nano"
106
+ monitoring = false
107
+ tenancy = " default"
108
+
80
109
vpc_security_group_ids_list = [module . ssh . security_group_ids , module . http-https . security_group_ids ]
81
110
subnet_ids = tolist (module. public_subnets . public_subnet_id )
82
111
83
- assign_eip_address = true
112
+ assign_eip_address = true
113
+ associate_public_ip_address = true
114
+
115
+ instance_profile_enabled = true
116
+ iam_instance_profile = module. iam-role . name
84
117
118
+ disk_size = 8
119
+ ebs_optimized = false
85
120
ebs_volume_enabled = true
86
121
ebs_volume_type = " gp2"
87
122
ebs_volume_size = 30
88
123
}
89
124
90
- module "acm" {
91
- source = " git::https://github.com/clouddrove/terraform-aws-acm.git?ref=tags/0.12.0"
92
-
93
- name = " certificate"
94
- application = " clouddrove"
95
- environment = " test"
96
- label_order = [" environment" , " name" , " application" ]
97
-
98
- domain_name = " clouddrove.com"
99
- validation_method = " EMAIL"
100
- validate_certificate = true
101
- }
102
125
103
126
module "alb" {
104
- source = " git::https://github.com/clouddrove/terraform-aws-alb.git?ref=tags/0.12.2 "
127
+ source = " ./../ "
105
128
106
129
name = " alb"
107
130
application = " clouddrove"
108
131
environment = " test"
109
- label_order = [" environment" , " name " , " application " ]
132
+ label_order = [" environment" , " application " , " name " ]
110
133
111
134
internal = false
112
135
load_balancer_type = " application"
@@ -120,10 +143,9 @@ module "alb" {
120
143
target_group_protocol = " HTTP"
121
144
target_group_port = 80
122
145
123
- listener_certificate_arn = module. acm . arn
124
- https_enabled = true
125
- http_enabled = true
126
- https_port = 443
127
- listener_type = " forward"
146
+ https_enabled = false
147
+ http_enabled = true
148
+ https_port = 443
149
+ listener_type = " forward"
128
150
129
151
}
0 commit comments