Skip to content

This is a special version to build a docker image to run awspec test for terraform projects.

License

Notifications You must be signed in to change notification settings

alpine-docker/bundle-terraform-awspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform awspec docker image

This is a special version to build a docker image for terraform awspec testing.

Table of Contents generated with DocToc

Dockerfile

https://github.com/alpine-docker/bundle-terraform-awspec/blob/master/Dockerfile

Public image

https://hub.docker.com/r/alpine/bundle-terraform-awspec/tags/

build local image

docker buld -t terraform-awspec .

Installed tools

ruby v2.4.2
gem bundler
gem awspec
gem kitchen-terraform
gme kitchen-verifier-awspec
terraform v0.11.7
kubectl
heptio authorizer v0.3.0

Usage

Use repo terraform-aws-modules/terraform-aws-eks as sample.

# git clone https://github.com/terraform-aws-modules/terraform-aws-eks.git
$ cd terraform-aws-eks
# Mount the local folder to /apps in container.
# Share aws credentials into containers (or by environment variables, such as AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID, and AWS_SESSION_TOKEN
$ docker run -ti -v $(pwd):/apps -v ~/.aws:/root/.aws alpine/bundle-terraform-awspec:1.0 bash
$ bundle install
$ bundle exec kitchen create
$ bundle exec kitchen converge
$ bundle exec kitchen setup
$ bundle exec kitchen verify
$ bundle exec kitchen destroy

# Above bundle commands can be combined with one command
$ bundle exec kitchen test

# run bundle container as command
alias bundle="docker run -ti --rm -v $(pwd):/apps alpine/bundle-terraform-awspec:1.0 bundle "
bundle --help

If you need test with other terraform versions, download specified terraform version from Linux 64-bit, give execute permission (chmod +x <path>/terraform), run below command:

docker run -ti -v $(pwd):/apps -v ~/.aws:/root/.aws -v <path>/terraform:/usr/bin/terraform alpine/bundle-terraform-awspec:1.0 bash

About

This is a special version to build a docker image to run awspec test for terraform projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published