Skip to content

Commit

Permalink
Merge pull request #2 from devops-workflow/master
Browse files Browse the repository at this point in the history
Merge upstream
  • Loading branch information
snemetz committed Mar 7, 2018
2 parents 8284c29 + 0d69a7d commit 018f128
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 126 deletions.
69 changes: 69 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: 2

jobs:
build:
docker:
- image: hashicorp/terraform:0.11.3
entrypoint: /bin/sh
steps:
- checkout
- run:
name: "Validate tf files (terraform validate)"
command: |
find . -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (terraform validate -check-variables=false "$m" && echo "√ $m") || exit 1 ; done
- run:
name: "Check: Terraform formatting (terraform fmt)"
command: |
if [ `terraform fmt --list=true -diff=true -write=false | tee format-issues | wc -c` -ne 0 ]; then
echo "Some terraform files need be formatted, run 'terraform fmt' to fix"
echo "Formatting issues:"
cat format-issues
exit 1
fi
- run:
name: "Install: tflint"
command: |
apk add jq wget
# Get latest version of tflint
pkg_arch=linux_amd64
dl_url=$(curl -s https://api.github.com/repos/wata727/tflint/releases/latest | jq -r ".assets[] | select(.name | test(\"${pkg_arch}\")) | .browser_download_url")
wget ${dl_url}
unzip tflint_linux_amd64.zip
mkdir -p /usr/local/tflint/bin
# Setup PATH for later run steps - ONLY for Bash and not in Bash
#echo 'export PATH=/usr/local/tflint/bin:$PATH' >> $BASH_ENV
echo "Installing tflint..."
install tflint /usr/local/tflint/bin
echo "Configuring tflint..."
tf_ver=$(terraform version | awk 'FNR <= 1' | cut -dv -f2)
echo -e "\tConfig for terraform version: ${tf_ver}"
if [ -f '.tflint.hcl' ]; then
sed -i "/terraform_version =/s/\".*\"/\"${tf_ver}\"/" .tflint.hcl
else
{
echo -e "config {\nterraform_version = \"${tf_ver}\"\ndeep_check = true\nignore_module = {"
for module in $(grep -h '[^a-zA-Z]source[ =]' *.tf | sed -r 's/.*=\s+//' | sort -u); do
# if not ^"../
echo "${module} = true"
done
echo "}}"
} > .tflint.hcl
fi
echo "tflint configuration:"
cat .tflint.hcl
- run:
# Not supporting modules from registry ?? v0.5.4
# For now, must ignore in config file
name: "Check: tflint"
command: |
#echo "Initializing terraform..."
#terraform init -input=false
echo "Running tflint..."
/usr/local/tflint/bin/tflint --version
/usr/local/tflint/bin/tflint
workflows:
version: 2
build:
jobs:
- build
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# terraform-aws-alb
A Terraform module containing common configurations for an AWS new style Load
Balancer (ALB/NLB). Available through the [terraform registry](https://registry.terraform.io/modules/devops-workflow/lb/aws).
Expand All @@ -6,7 +7,8 @@ Balancer (ALB/NLB). Available through the [terraform registry](https://registry.

| Branch | Build status |
| --- | --- |
| master | [![build Status](https://travis-ci.org/terraform-aws-modules/terraform-aws-alb.svg?branch=master)](https://travis-ci.org/terraform-aws-modules/terraform-aws-alb) |
| master | [![CircleCI](https://circleci.com/gh/devops-workflow/terraform-aws-alb.svg?style=svg)](https://circleci.com/gh/devops-workflow/terraform-aws-alb) |
| master | [![TravisCI](https://travis-ci.org/terraform-aws-modules/terraform-aws-alb.svg?branch=master)](https://travis-ci.org/terraform-aws-modules/terraform-aws-alb) |

## Assumptions
* You want to create a set of resources for the ALB: namely an associated target group and listener.
Expand Down
6 changes: 3 additions & 3 deletions examples/test_fixtures/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ module "security-group" {

module "lb" {
source = "../.."
lb_name = "my-lb"
lb_security_groups = ["${module.security-group.this_security_group_id}"]
lb_name = "my-lb"
lb_security_groups = ["${module.security-group.this_security_group_id}"]
region = "${var.region}"
vpc_id = "${module.vpc.vpc_id}"
subnets = "${module.vpc.public_subnets}"
certificate_arn = "${aws_iam_server_certificate.fixture_cert.arn}"
lb_protocols = ["HTTPS"]
lb_protocols = ["HTTPS"]
health_check_path = "/"
create_log_bucket = true
enable_logging = true
Expand Down
Loading

0 comments on commit 018f128

Please sign in to comment.