Skip to content

Commit

Permalink
Convert to TF 0.12. Add tests. Add Codefresh test pipeline (#38)
Browse files Browse the repository at this point in the history
* Convert to TF 0.12

* Convert to TF 0.12

* Convert to TF 0.12

* Convert to TF 0.12

* Convert to TF 0.12

* Convert to TF 0.12. Add tests. Add Codefresh test pipeline

* Convert to TF 0.12. Add tests. Add Codefresh test pipeline
  • Loading branch information
aknysh authored Nov 3, 2019
1 parent 2e318f7 commit 9d86839
Show file tree
Hide file tree
Showing 31 changed files with 2,995 additions and 933 deletions.
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

255 changes: 149 additions & 106 deletions README.md

Large diffs are not rendered by default.

37 changes: 20 additions & 17 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ github_repo: cloudposse/terraform-aws-ecs-web-app

# Badges to display
badges:
- name: "Build Status"
image: "https://travis-ci.org/cloudposse/terraform-aws-ecs-web-app.svg?branch=master"
url: "https://travis-ci.org/cloudposse/terraform-aws-ecs-web-app"
- name: "Codefresh Build Status"
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-ecs-web-app?type=cf-1"
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/5dbb22a15c2e97b3b73ab484"
- name: "Latest Release"
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-ecs-web-app.svg"
url: "https://github.com/cloudposse/terraform-aws-ecs-web-app/releases/latest"
Expand Down Expand Up @@ -70,30 +70,33 @@ description: |-
# How to use this project
usage: |-
Module usage examples:
For a complete example, see [examples/complete](examples/complete).
- [without authentication](examples/without_authentication) - complete example without authentication
- [with Google OIDC authentication](examples/with_google_oidc_authentication) - complete example with Google OIDC authentication
- [with Cognito authentication](examples/with_cognito_authentication) - complete example with Cognito authentication
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 test and deploy the example on AWS), see [test](test).
Other examples:
- [without authentication](examples/without_authentication) - without authentication
- [with Google OIDC authentication](examples/with_google_oidc_authentication) - with Google OIDC authentication
- [with Cognito authentication](examples/with_cognito_authentication) - with Cognito authentication
```
module "default-backend-web-app" {
module "default_backend_web_app" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-web-app.git?ref=master"
namespace = "eg"
stage = "testing"
name = "appname"
vpc_id = "${module.vpc.vpc_id}"
alb_ingress_unauthenticated_listener_arns = "${module.alb.listener_arns}"
alb_ingress_unauthenticated_listener_arns_count = "1"
aws_logs_region = "us-west-2"
ecs_cluster_arn = "${aws_ecs_cluster.default.arn}"
ecs_cluster_name = "${aws_ecs_cluster.default.name}"
ecs_security_group_ids = ["${module.vpc.vpc_default_security_group_id}"]
ecs_private_subnet_ids = ["${module.subnets.private_subnet_ids}"]
vpc_id = module.vpc.vpc_id
alb_ingress_unauthenticated_listener_arns = module.alb.listener_arns
alb_ingress_unauthenticated_listener_arns_count = 1
aws_logs_region = "us-east-2"
ecs_cluster_arn = aws_ecs_cluster.default.arn
ecs_cluster_name = aws_ecs_cluster.default.name
ecs_security_group_ids = [module.vpc.vpc_default_security_group_id]
ecs_private_subnet_ids = module.subnets.private_subnet_ids
alb_ingress_healthcheck_path = "/healthz"
alb_ingress_unauthenticated_paths = ["/*"]
codepipeline_enabled = "false"
codepipeline_enabled = false
environment = [
{
Expand Down
74 changes: 74 additions & 0 deletions codefresh/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
version: '1.0'

stages:
- Prepare
- Test

steps:
wait:
title: Wait
stage: Prepare
image: codefresh/cli:latest
commands:
- codefresh get builds --pipeline=${{CF_REPO_NAME}} --status running --limit 1000 -o json | jq --arg id ${{CF_BUILD_ID}} -ser 'flatten|.[-1].id==$id'
retry:
maxAttempts: 10
delay: 20
exponentialFactor: 1.1

main_clone:
title: "Clone repository"
type: git-clone
stage: Prepare
description: "Initialize"
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
git: CF-default
revision: ${{CF_REVISION}}

clean_init:
title: Prepare build-harness and test-harness
image: ${{TEST_IMAGE}}
stage: Prepare
commands:
- cf_export PATH="/usr/local/terraform/0.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- make init
- git -C build-harness checkout master
- make -C test/ clean init TEST_HARNESS_BRANCH=master
- make -C test/src clean init
- find . -type d -name '.terraform' | xargs rm -rf
- find . -type f -name 'terraform.tfstate*' -exec rm -f {} \;

test:
type: "parallel"
title: "Run tests"
description: "Run all tests in parallel"
stage: Test
steps:
test_readme_lint:
title: "Test README.md updated"
stage: "Test"
image: ${{TEST_IMAGE}}
description: Test "readme/lint"
commands:
- make readme/lint

test_module:
title: Test module with bats
image: ${{TEST_IMAGE}}
stage: Test
commands:
- make -C test/ module

test_examples_complete:
title: Test "examples/complete" with bats
image: ${{TEST_IMAGE}}
stage: Test
commands:
- make -C test/ examples/complete

test_examples_complete_terratest:
title: Test "examples/complete" with terratest
image: ${{TEST_IMAGE}}
stage: Test
commands:
- make -C test/src
Loading

0 comments on commit 9d86839

Please sign in to comment.