Google Docker Guide

Here’s a guide to using Terraspace, Docker and Google.


To use Cloud provider with Terraspace and Docker container you should mount the credentials.

docker run --rm -ti -v $HOME/.config/gcloud:/root/.config/gcloud

Editing Files

It is useful to be able to edit files with an text editor in your normal OS. You can do this by mounting a folder from your current host to a volume. Here an example that mounts the current working directory to the /work folder within the Docker container.

docker run --rm -ti -v $HOME/.config/gcloud:/root/.config/gcloud -v `pwd`:/work

Env Variables

Using env files is also handy. Here’s an example dev.env file.


And how to use the env file.

docker run --rm -ti \
    -v $HOME/.config/gcloud:/root/.config/gcloud \
    -v `pwd`:/work \
    --env-file dev.env \

Test Terraspace

Once you’ve started and are inside a container, you can start trying out terraspace.

terraspace new project -p google infra --examples
cd infra
terraspace up demo -y
terraspace down demo -y

For a more detailed Learn Guide check out Google Learn Guide.

More tools: