kvn-repo / docker-terraform-packer

Docker image for common DevOps tools

Home Page:https://hub.docker.com/r/thatarchguy/terraform-packer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thatarchguy/terraform-packer

Docker image with Hashicorp Terraform + Hashicorp Packer + AWS CLI + Goodies

Github https://github.com/thatarchguy/docker-terraform-packer

Packages

- ca-certificates
- update-ca-certificates
- curl
- unzip
- bash
- python
- py-pip
- openssh
- git
- make
- tzdata
- awscli (via PIP)  
- jq

INFO

Usage

$> docker run --rm -v $(pwd):/opt/workspace \
   		thatarchguy/terraform-packer \
   		terraform [--version] [--help] <command> [args]

Setting timezone

$> docker run --rm -v $(pwd):/opt/workspace \
        -e TZ=Australia/Sydney \
   		thatarchguy/terraform-packer \
   		terraform [--version] [--help] <command> [args]

Example

$> docker run --rm -v $(pwd):/opt/workspace \
   		thatarchguy/terraform-packer \
   		terraform $1 -var-file variables.tfvars \
   		-var aws_access_key=${aws_access_key_id} \
   		-var aws_secret_key=${aws_secret_access_key}

Makefile example

# VARS
TF_IMAGE?=thatarchguy/terraform-packer:latest
VARS_FILE?=variables.tfvars

# TF
tf-plan:
	$(call terraform, plan)
.PHONY: tf-plan

tf-apply:
	$(call terraform, apply)
.PHONY: tf-apply

tf-destroy:
	$(call terraform, destroy)
.PHONY: tf-destroy

tf-refresh:
	$(call terraform, refresh)
.PHONY: tf-refresh

tf-show:
	$(call terraform, show)
.PHONY: tf-show

tf-shell:
	@docker run --rm -it -v $(shell pwd):/opt/workspace \
    		$(TF_IMAGE)\
    		bash
.PHONY: tf-shell

tf-state-list:
	$(call terraform, state list)
.PHONY: tf-show

# DOCKER
tf-image-update:
	docker pull $(TF_IMAGE)
.PHONY: tf-image-update

# ROUTINES
define terraform
	@docker run --rm -v $(shell pwd):/opt/workspace \
		$(TF_IMAGE)\
		terraform $1 -var-file $(VARS_FILE) \
		-var aws_access_key=${aws_access_key_id} \
		-var aws_secret_key=${aws_secret_access_key}
endef

About

Docker image for common DevOps tools

https://hub.docker.com/r/thatarchguy/terraform-packer


Languages

Language:Dockerfile 54.9%Language:Makefile 45.1%