kaofelix / docker-terraform

Run terraform from a docker container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-terraform

Run terraform from a docker container. Includes terraform-provider-mongodbatlas.

Based on docker-autostacker

Usage

Run the container like this:

docker run \
    -v "${PWD}:/workdir" \            # <-- this mounts your current directory inside the container's work dir
    -v "${HOME}/.aws:/.aws:ro" \      # <-- this mounts your aws credentials inside the container's home dir
    -e AWS_PROFILE=some-aws-profile \ # <-- choose your aws profile
    kaofelix/terraform \
    apply                             # <-- run any terraform command

You might want to add the following function to your .bashrc or similar to allow even easier usage:

function terraform() {
    docker run \
        --rm \
        -v "${PWD}:/workdir" \
        -v "${HOME}/.aws:/.aws:ro" \
        -e "AWS_PROFILE=${AWS_PROFILE}" \
        -e "AWS_REGION=${AWS_REGION}" \
        kaofelix/terraform \
        "${@}"
}

About

Run terraform from a docker container.


Languages

Language:Dockerfile 100.0%