Blog

Configure a GitHub Codespaces Docker File for Google Cloud SDK and Terraform

, John Comber

Introduction

This example demonstrates how to configure a GitHub Codespaces Docker file for Google Cloud SDK and Terraform.

Code

FROM mcr.microsoft.com/devcontainers/base:bullseye

TERRAFORM_VERSION=1.3.9

# Google Cloud SDK
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
    && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | tee /usr/share/keyrings/cloud.google.gpg \
    && apt-get update -y \
    && apt-get install google-cloud-sdk -y

# Terraform
RUN echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \
    && wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg \
    && apt-get update -y \
    && apt-get install terraform=$TERRAFORM_VERSION -y \
    && terraform -version

Licence

MIT