- Dockerfile 65.6%
- HCL 34.4%
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> |
||
|---|---|---|
| docker | ||
| tutorial | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
Terraform Getting Started Guide on GCP with Cloud Shell
A Getting Started Tutorial for Terraform and Google Cloud Platform (GCP), using Google's interactive Cloud Shell.
This tutorial will help you learn Terraform, an open source Infrastructure as Code tool.
This tutorial assumes you know basic GCP concepts and terminology.
Launch the tutorial
To follow this tutorial, you will need a Google Cloud Platform account. If you do not have a GCP account, create one now. This tutorial uses services included in the GCP free tier.
Complete this tutorial in Google's Cloud Shell.
When prompted to trust the tutorial image, answer "Yes".
Use a custom image
This tutorial uses a Docker image. The version of Terraform included in that image (v1.0.1) may not be the latest version. To build and use a Docker image with the latest version see the instructions below.
Build the Docker image
- Set up Docker and the gcloud command line utility as described in the "Before you begin" section of the GCP Container Registry Quickstart.
- Build the image:
docker build . -t terraform-gcp-gsg:v$(date "+%Y-%m-%d") - Optionally, inspect/test image locally:
docker run -it --entrypoint /bin/sh terraform-gcp-gsg:v$(date "+%Y-%m-%d")
Deploy Docker Image the GCP Image Registry
- Make sure docker is configured to authenticate with gcloud:
gcloud auth configure-docker - Tag the image, replacing
[PROJECT-ID]with your Google Cloud's project ID:docker tag terraform-gcp-gsg:v$(date "+%Y-%m-%d") gcr.io/[PROJECT-ID]/terraform-gcp-gsg:v$(date "+%Y-%m-%d")
Use the Docker image with Cloud Shell
- Update the URL above to use the URL to your new docker image.
- You'll be prompted to trust this image. Answer "Yes".