Skip to content

Commit

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

* Updated Readme

* Updated Readme

* Updated Readme

* Updated Readme

* Updated Readme

* Fix tests

* Fix tests

* Fix tests

* 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

* 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
goruha authored and aknysh committed Oct 8, 2019
1 parent 01d4052 commit fe6d0d7
Show file tree
Hide file tree
Showing 25 changed files with 1,810 additions and 1,161 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*.tfstate
*.tfstate.*

# .tfvars files
*.tfvars

**/.idea
**/*.iml

Expand Down
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017-2018 Cloud Posse, LLC
Copyright 2017-2019 Cloud Posse, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
256 changes: 172 additions & 84 deletions README.md

Large diffs are not rendered by default.

105 changes: 101 additions & 4 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ tags:
- elastic-beanstalk
- elasticbeanstalk
- environment
- elastic-beanstalk-application
- elastic-beanstalk-environment

# Categories of this project
categories:
Expand All @@ -32,9 +34,9 @@ github_repo: cloudposse/terraform-aws-elastic-beanstalk-environment

# Badges to display
badges:
- name: "Build Status"
image: "https://travis-ci.org/cloudposse/terraform-aws-elastic-beanstalk-environment.svg?branch=master"
url: "https://travis-ci.org/cloudposse/terraform-aws-elastic-beanstalk-environment"
- name: "Codefresh Status"
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-elastic-beanstalk-environment?type=cf-1"
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/5d182cb1ac440444a6c0082b"
- name: "Latest Release"
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-elastic-beanstalk-environment.svg"
url: "https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment/releases/latest"
Expand All @@ -60,8 +62,97 @@ related:
description: |-
Terraform module to provision AWS Elastic Beanstalk environment
# How to use this project
usage: |-
Complete example: [examples/complete](examples/complete)
For a complete example, see [examples/complete](examples/complete)
```hcl
provider "aws" {
region = var.region
}
module "vpc" {
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.0"
namespace = var.namespace
stage = var.stage
name = var.name
cidr_block = "172.16.0.0/16"
}
module "subnets" {
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.0"
availability_zones = var.availability_zones
namespace = var.namespace
stage = var.stage
name = var.name
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
nat_gateway_enabled = true
nat_instance_enabled = false
}
module "elastic_beanstalk_application" {
source = "git::https://github.com/cloudposse/terraform-aws-elastic-beanstalk-application.git?ref=tags/0.3.0"
namespace = var.namespace
stage = var.stage
name = var.name
description = "Test elastic_beanstalk_application"
}
module "elastic_beanstalk_environment" {
source = "git::https://github.com/cloudposse/terraform-aws-elastic-beanstalk-environment.git?ref=master"
namespace = var.namespace
stage = var.stage
name = var.name
description = "Test elastic_beanstalk_environment"
region = var.region
availability_zone_selector = "Any 2"
dns_zone_id = var.dns_zone_id
elastic_beanstalk_application_name = module.elastic_beanstalk_application.elastic_beanstalk_application_name
instance_type = "t3.small"
autoscale_min = 1
autoscale_max = 2
updating_min_in_service = 0
updating_max_batch = 1
loadbalancer_type = "application"
vpc_id = module.vpc.vpc_id
loadbalancer_subnets = module.subnets.public_subnet_ids
application_subnets = module.subnets.private_subnet_ids
allowed_security_groups = [module.vpc.vpc_default_security_group_id]
// https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html
// https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.docker
solution_stack_name = "64bit Amazon Linux 2018.03 v2.12.17 running Docker 18.06.1-ce"
additional_settings = [
{
namespace = "aws:elasticbeanstalk:application:environment"
name = "DB_HOST"
value = "xxxxxxxxxxxxxx"
},
{
namespace = "aws:elasticbeanstalk:application:environment"
name = "DB_USERNAME"
value = "yyyyyyyyyyyyy"
},
{
namespace = "aws:elasticbeanstalk:application:environment"
name = "DB_PASSWORD"
value = "zzzzzzzzzzzzzzzzzzz"
},
{
namespace = "aws:elasticbeanstalk:application:environment"
name = "ANOTHER_ENV_VAR"
value = "123456789"
}
]
}
}
```
include:
- "docs/targets.md"
Expand All @@ -70,10 +161,16 @@ include:
# Contributors to this project
contributors:
- name: "Erik Osterman"
homepage: "https://github.com/osterman"
avatar: "http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144"
github: "osterman"
- name: "Igor Rodionov"
homepage: "https://github.com/goruha/"
avatar: "http://s.gravatar.com/avatar/bc70834d32ed4517568a1feb0b9be7e2?s=144"
github: "goruha"
- name: "Andriy Knysh"
homepage: "https://github.com/aknysh/"
avatar: "https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "aknysh"
- name: "Guillaume Delacour"
github: "guikcd"
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: github
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 fe6d0d7

Please sign in to comment.