@@ -8,29 +8,28 @@ data "aws_vpc" "selected" {
8
8
}
9
9
10
10
data "aws_ecs_cluster" "default" {
11
- cluster_name = " default "
11
+ cluster_name = var . ecs_cluster_name
12
12
}
13
13
14
14
data "aws_iam_policy_document" "ecs_task_assume_policy" {
15
15
statement {
16
- actions = [ " sts:AssumeRole " ]
16
+ actions = local . ecs_task_assume_policy_actions
17
17
principals {
18
- type = " Service "
19
- identifiers = [ " ecs-tasks.amazonaws.com " ]
18
+ type = local . ecs_task_assume_policy_principal_type
19
+ identifiers = local . ecs_task_assume_policy_principal_identifiers
20
20
}
21
21
}
22
22
}
23
23
24
24
data "aws_acm_certificate" "base_domain_certificate" {
25
25
domain = local. base_domain
26
- statuses = [ " ISSUED " ]
26
+ statuses = local . acm_certificate_statuses
27
27
}
28
28
29
29
data "aws_route53_zone" "zone" {
30
30
name = local. base_domain
31
31
}
32
32
33
-
34
33
module "ecs_deployment" {
35
34
source = " infraspecdev/ecs-deployment/aws"
36
35
version = " 3.0.1"
@@ -63,11 +62,11 @@ module "ecs_deployment" {
63
62
}
64
63
service = {
65
64
name = local.ecs_service_name
66
- desired_count = var.ecs_service_desired_count != null ? var.ecs_service_desired_count : 1
65
+ desired_count = var.ecs_service_desired_count != null ? var.ecs_service_desired_count : local.default_desired_count
67
66
load_balancer = [{
68
67
container_name = local.ecs_container_definations_name
69
68
container_port = local.container_port
70
- target_group = " atlantis-target-group "
69
+ target_group = local.target_group_name
71
70
}]
72
71
73
72
network_configuration = {
@@ -86,25 +85,25 @@ module "ecs_deployment" {
86
85
atlantis-target-group = {
87
86
name = format (" %s-%s-ip" , local. alb_system_name , terraform. workspace )
88
87
port = local.container_port
89
- protocol = " HTTP "
88
+ protocol = local.target_group_protocol
90
89
target_type = local.alb_ip_target_type
91
90
}
92
91
}
93
92
94
93
listeners = {
95
94
https-listener = {
96
- protocol = " HTTPS "
97
- port = 443
95
+ protocol = local.listener_protocol
96
+ port = local.listener_port
98
97
certificate_arn = data.aws_acm_certificate.base_domain_certificate.arn
99
98
100
99
default_action = [
101
100
{
102
- type = " fixed-response "
103
- target_group = " atlantis-target-group "
101
+ type = local.default_action_type
102
+ target_group = local.target_group_name
104
103
fixed_response = {
105
- content_type = " application/json "
106
- message_body = " Unauthorised "
107
- status_code = 404
104
+ content_type = local.fixed_response_content_type
105
+ message_body = local.fixed_response_message_body
106
+ status_code = local.fixed_response_status_code
108
107
}
109
108
}
110
109
]
@@ -113,8 +112,8 @@ module "ecs_deployment" {
113
112
114
113
listener_rules = {
115
114
https-listener-rules = {
116
- listener = " https-listener "
117
- priority = 10
115
+ listener = local.listener_name
116
+ priority = local.listener_priority
118
117
119
118
condition = [
120
119
{
@@ -126,39 +125,39 @@ module "ecs_deployment" {
126
125
127
126
action = [
128
127
{
129
- type = " authenticate-oidc "
128
+ type = local.authenticate_oidc_type
130
129
131
130
authenticate_oidc = {
132
131
authorization_endpoint = local.authenticate_oidc_authorization_endpoint
133
132
token_endpoint = local.authenticate_oidc_token_endpoint
134
133
user_info_endpoint = local.authenticate_oidc_user_info_endpoint
135
134
issuer = local.authenticate_oidc_issuer
136
135
session_cookie_name = format (" TOKEN-OIDC-%s" , data. aws_ssm_parameter . environment [" ATLANTIS_GOOGLE_CLIENT_ID" ]. value )
137
- scope = " openid email "
138
- on_unauthenticated_request = " authenticate "
136
+ scope = local.authenticate_oidc_scope
137
+ on_unauthenticated_request = local.authenticate_oidc_on_unauthenticated_request
139
138
client_id = data.aws_ssm_parameter.environment[" ATLANTIS_GOOGLE_CLIENT_ID" ].value
140
139
client_secret = data.aws_ssm_parameter.environment[" ATLANTIS_GOOGLE_CLIENT_SECRET" ].value
141
140
}
142
141
},
143
142
{
144
- target_group = " atlantis-target-group "
145
- type = " forward "
143
+ target_group = local.target_group_name
144
+ type = local.forward_action_type
146
145
}
147
146
]
148
147
},
149
148
http-listener-rules = {
150
- listener = " https-listener "
151
- priority = 1
149
+ listener = local.listener_name
150
+ priority = local.http_listener_priority
152
151
153
152
condition = [
154
153
{
155
154
path_pattern = {
156
- values = [ " /events " ]
155
+ values = local.path_pattern_values
157
156
}
158
157
},
159
158
{
160
159
http_request_method = {
161
- values = [ " POST " ]
160
+ values = local.http_request_method_values
162
161
}
163
162
},
164
163
{
@@ -170,13 +169,13 @@ module "ecs_deployment" {
170
169
171
170
action = [
172
171
{
173
- target_group = " atlantis-target-group "
174
- type = " forward "
172
+ target_group = local.target_group_name
173
+ type = local.forward_action_type
175
174
}
176
175
]
177
176
}
178
177
}
179
178
}
180
179
181
- create_capacity_provider = false
180
+ create_capacity_provider = local . create_capacity_provider
182
181
}
0 commit comments