@@ -24,9 +24,9 @@ screenshots:
24
24
25
25
# Badges to display
26
26
badges :
27
- - name : " Build Status"
28
- image : " https://travis-ci.org/ cloudposse/terraform-aws-ecs-atlantis.svg?branch=master "
29
- url : " https://travis-ci.org/ cloudposse/terraform-aws-ecs-atlantis "
27
+ - name : " Codefresh Build Status"
28
+ image : " https://g.codefresh.io/api/badges/pipeline/ cloudposse/terraform-modules%2Fterraform- aws-ecs-atlantis?type=cf-1 "
29
+ url : " https://g.codefresh.io/public/accounts/ cloudposse/pipelines/5dc082b14d7990012e651a3b "
30
30
- name : " Latest Release"
31
31
image : " https://img.shields.io/github/release/cloudposse/terraform-aws-ecs-atlantis.svg"
32
32
url : " https://github.com/cloudposse/terraform-aws-ecs-atlantis/releases/latest"
@@ -159,11 +159,15 @@ introduction: |-
159
159
# How to use this project
160
160
usage : |-
161
161
162
- Module usage examples:
162
+ For a complete example, see [ examples/complete](examples/complete).
163
163
164
- - [without authentication](examples/without_authentication) - complete example without authentication
165
- - [with Google OIDC authentication](examples/with_google_oidc_authentication) - complete example with Google OIDC authentication
166
- - [with Cognito authentication](examples/with_cognito_authentication) - complete example with Cognito authentication
164
+ For automated tests of the complete example using [bats](https://github.com/bats-core/bats-core) and [Terratest](https://github.com/gruntwork-io/terratest) (which tests and deploys the example on AWS), see [test](test).
165
+
166
+ Other examples:
167
+
168
+ - [without authentication](examples/without_authentication) - example without authentication
169
+ - [with Google OIDC authentication](examples/with_google_oidc_authentication) - example with Google OIDC authentication
170
+ - [with Cognito authentication](examples/with_cognito_authentication) - example with Cognito authentication
167
171
168
172
169
173
**NOTE:**
@@ -172,39 +176,198 @@ usage: |-
172
176
173
177
If no `github_webhooks_token` is set, [Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) attempts to look one up in the `GITHUB_TOKEN` environment variable.
174
178
175
- ```
176
- module "atlantis" {
177
- source = "git::https://github.com/cloudposse/terraform-aws-ecs-atlantis.git?ref=master"
178
- enabled = "true"
179
- name = "${var.name}"
180
- namespace = "${var.namespace}"
181
- region = "${var.region}"
182
- stage = "${var.stage}"
183
-
184
- atlantis_gh_team_whitelist = "admins:*,engineering:plan"
185
- atlantis_gh_user = "atlantis_bot"
186
- atlantis_repo_whitelist = ["github.com/testing.example.co/*"]
187
-
188
- alb_arn_suffix = "${module.alb.alb_arn_suffix}"
189
- alb_dns_name = "${module.alb.alb_dns_name}"
190
- alb_name = "${module.alb.alb_name}"
191
- alb_zone_id = "${module.alb.alb_zone_id}"
192
-
193
- domain_name = "${var.domain_name}"
194
- ecs_cluster_arn = "${aws_ecs_cluster.default.arn}"
195
- ecs_cluster_name = "${aws_ecs_cluster.default.name}"
196
- repo_name = "testing.example.co"
197
- repo_owner = "example_org"
198
- private_subnet_ids = ["${module.subnets.private_subnet_ids}"]
199
- security_group_ids = ["${module.vpc.vpc_default_security_group_id}"]
200
- vpc_id = "${module.vpc.vpc_id}"
201
-
202
- alb_ingress_unauthenticated_listener_arns = ["${module.alb.listener_arns}"]
203
- alb_ingress_unauthenticated_listener_arns_count = 2
204
- alb_ingress_unauthenticated_paths = ["/*"]
205
- alb_ingress_listener_unauthenticated_priority = "100"
206
- alb_ingress_authenticated_paths = []
207
- }
179
+ ```hcl
180
+ provider "aws" {
181
+ region = var.region
182
+ }
183
+
184
+ module "label" {
185
+ source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
186
+ namespace = var.namespace
187
+ name = var.name
188
+ stage = var.stage
189
+ delimiter = var.delimiter
190
+ attributes = var.attributes
191
+ tags = var.tags
192
+ }
193
+
194
+ module "vpc" {
195
+ source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
196
+ namespace = var.namespace
197
+ stage = var.stage
198
+ name = var.name
199
+ delimiter = var.delimiter
200
+ attributes = var.attributes
201
+ cidr_block = var.vpc_cidr_block
202
+ tags = var.tags
203
+ }
204
+
205
+ module "subnets" {
206
+ source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.1"
207
+ availability_zones = var.availability_zones
208
+ namespace = var.namespace
209
+ stage = var.stage
210
+ name = var.name
211
+ attributes = var.attributes
212
+ delimiter = var.delimiter
213
+ vpc_id = module.vpc.vpc_id
214
+ igw_id = module.vpc.igw_id
215
+ cidr_block = module.vpc.vpc_cidr_block
216
+ nat_gateway_enabled = true
217
+ nat_instance_enabled = false
218
+ tags = var.tags
219
+ }
220
+
221
+ module "alb" {
222
+ source = "git::https://github.com/cloudposse/terraform-aws-alb.git?ref=tags/0.7.0"
223
+ namespace = var.namespace
224
+ stage = var.stage
225
+ name = var.name
226
+ attributes = var.attributes
227
+ delimiter = var.delimiter
228
+ vpc_id = module.vpc.vpc_id
229
+ security_group_ids = [module.vpc.vpc_default_security_group_id]
230
+ subnet_ids = module.subnets.public_subnet_ids
231
+ internal = false
232
+ http_enabled = true
233
+ access_logs_enabled = false
234
+ alb_access_logs_s3_bucket_force_destroy = true
235
+ access_logs_region = var.region
236
+ cross_zone_load_balancing_enabled = true
237
+ http2_enabled = true
238
+ deletion_protection_enabled = false
239
+ tags = var.tags
240
+ }
241
+
242
+ resource "aws_ecs_cluster" "default" {
243
+ name = module.label.id
244
+ tags = module.label.tags
245
+ }
246
+
247
+ resource "aws_sns_topic" "sns_topic" {
248
+ name = module.label.id
249
+ display_name = "Test terraform-aws-ecs-atlantis"
250
+ tags = module.label.tags
251
+ }
252
+
253
+ module "kms_key" {
254
+ source = "git::https://github.com/cloudposse/terraform-aws-kms-key.git?ref=tags/0.3.0"
255
+ enabled = var.enabled
256
+ namespace = var.namespace
257
+ stage = var.stage
258
+ name = var.name
259
+ attributes = var.attributes
260
+ delimiter = var.delimiter
261
+ tags = var.tags
262
+ description = "Test terraform-aws-ecs-atlantis KMS key"
263
+ deletion_window_in_days = 7
264
+ enable_key_rotation = false
265
+ }
266
+
267
+ module "atlantis" {
268
+ source = "git::https://github.com/cloudposse/terraform-aws-ecs-atlantis.git?ref=master"
269
+ enabled = var.enabled
270
+ namespace = var.namespace
271
+ stage = var.stage
272
+ name = var.name
273
+ attributes = var.attributes
274
+ delimiter = var.delimiter
275
+ tags = var.tags
276
+
277
+ region = var.region
278
+ vpc_id = module.vpc.vpc_id
279
+ policy_arn = var.policy_arn
280
+ ssh_private_key_name = var.ssh_private_key_name
281
+ ssh_public_key_name = var.ssh_public_key_name
282
+ kms_key_id = module.kms_key.key_id
283
+
284
+ atlantis_gh_user = var.atlantis_gh_user
285
+ atlantis_gh_team_whitelist = var.atlantis_gh_team_whitelist
286
+ atlantis_gh_webhook_secret = var.atlantis_gh_webhook_secret
287
+ atlantis_log_level = var.atlantis_log_level
288
+ atlantis_repo_config = var.atlantis_repo_config
289
+ atlantis_repo_whitelist = var.atlantis_repo_whitelist
290
+ atlantis_port = var.atlantis_port
291
+ atlantis_webhook_format = var.atlantis_webhook_format
292
+ atlantis_url_format = var.atlantis_url_format
293
+
294
+ default_backend_image = var.default_backend_image
295
+ healthcheck_path = var.healthcheck_path
296
+ short_name = var.short_name
297
+ hostname = var.hostname
298
+ parent_zone_id = var.parent_zone_id
299
+
300
+ // Container
301
+ container_cpu = var.container_cpu
302
+ container_memory = var.container_memory
303
+
304
+ // Authentication
305
+ authentication_type = var.authentication_type
306
+ alb_ingress_listener_unauthenticated_priority = var.alb_ingress_listener_unauthenticated_priority
307
+ alb_ingress_listener_authenticated_priority = var.alb_ingress_listener_authenticated_priority
308
+ alb_ingress_unauthenticated_hosts = var.alb_ingress_unauthenticated_hosts
309
+ alb_ingress_authenticated_hosts = var.alb_ingress_authenticated_hosts
310
+ alb_ingress_unauthenticated_paths = var.alb_ingress_unauthenticated_paths
311
+ alb_ingress_authenticated_paths = var.alb_ingress_authenticated_paths
312
+ authentication_cognito_user_pool_arn = var.authentication_cognito_user_pool_arn
313
+ authentication_cognito_user_pool_client_id = var.authentication_cognito_user_pool_client_id
314
+ authentication_cognito_user_pool_domain = var.authentication_cognito_user_pool_domain
315
+ authentication_oidc_client_id = var.authentication_oidc_client_id
316
+ authentication_oidc_client_secret = var.authentication_oidc_client_secret
317
+ authentication_oidc_issuer = var.authentication_oidc_issuer
318
+ authentication_oidc_authorization_endpoint = var.authentication_oidc_authorization_endpoint
319
+ authentication_oidc_token_endpoint = var.authentication_oidc_token_endpoint
320
+ authentication_oidc_user_info_endpoint = var.authentication_oidc_user_info_endpoint
321
+
322
+ // ECS
323
+ private_subnet_ids = module.subnets.private_subnet_ids
324
+ ecs_cluster_arn = aws_ecs_cluster.default.arn
325
+ ecs_cluster_name = aws_ecs_cluster.default.name
326
+ security_group_ids = var.security_group_ids
327
+ desired_count = var.desired_count
328
+ launch_type = var.launch_type
329
+
330
+ // ALB
331
+ alb_zone_id = module.alb.alb_zone_id
332
+ alb_arn_suffix = module.alb.alb_arn_suffix
333
+ alb_dns_name = module.alb.alb_dns_name
334
+ alb_security_group = module.alb.security_group_id
335
+ alb_ingress_unauthenticated_listener_arns = [module.alb.http_listener_arn]
336
+ alb_ingress_unauthenticated_listener_arns_count = 1
337
+
338
+ // CodePipeline
339
+ codepipeline_enabled = var.codepipeline_enabled
340
+ github_oauth_token = var.github_oauth_token
341
+ github_webhooks_token = var.github_webhooks_token
342
+ repo_owner = var.repo_owner
343
+ repo_name = var.repo_name
344
+ branch = var.branch
345
+ build_timeout = var.build_timeout
346
+ webhook_enabled = var.webhook_enabled
347
+ webhook_secret_length = var.webhook_secret_length
348
+ webhook_events = var.webhook_events
349
+ codepipeline_s3_bucket_force_destroy = var.codepipeline_s3_bucket_force_destroy
350
+
351
+ // Autoscaling
352
+ autoscaling_enabled = var.autoscaling_enabled
353
+ autoscaling_min_capacity = var.autoscaling_min_capacity
354
+ autoscaling_max_capacity = var.autoscaling_max_capacity
355
+
356
+ // Alarms
357
+ alb_target_group_alarms_enabled = var.alb_target_group_alarms_enabled
358
+ ecs_alarms_enabled = var.ecs_alarms_enabled
359
+ alb_target_group_alarms_alarm_actions = [aws_sns_topic.sns_topic.arn]
360
+ alb_target_group_alarms_ok_actions = [aws_sns_topic.sns_topic.arn]
361
+ alb_target_group_alarms_insufficient_data_actions = [aws_sns_topic.sns_topic.arn]
362
+ ecs_alarms_cpu_utilization_high_alarm_actions = [aws_sns_topic.sns_topic.arn]
363
+ ecs_alarms_cpu_utilization_high_ok_actions = [aws_sns_topic.sns_topic.arn]
364
+ ecs_alarms_cpu_utilization_low_alarm_actions = [aws_sns_topic.sns_topic.arn]
365
+ ecs_alarms_cpu_utilization_low_ok_actions = [aws_sns_topic.sns_topic.arn]
366
+ ecs_alarms_memory_utilization_high_alarm_actions = [aws_sns_topic.sns_topic.arn]
367
+ ecs_alarms_memory_utilization_high_ok_actions = [aws_sns_topic.sns_topic.arn]
368
+ ecs_alarms_memory_utilization_low_alarm_actions = [aws_sns_topic.sns_topic.arn]
369
+ ecs_alarms_memory_utilization_low_ok_actions = [aws_sns_topic.sns_topic.arn]
370
+ }
208
371
```
209
372
210
373
# Example usage
0 commit comments