Set up your development environment

Set up your development environment #

Before you start adding or updating a Terraform resource using magic-modules, you must first set up your environment by installing the necessary tools. This page explains the steps for setting up your development environment.

  1. Install the gcloud CLI.

  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Note: If you don’t already have a project to use for testing changes to the Terraform providers, create a project instead of selecting an existing poject. After you finish these steps, you can delete the project, removing all resources associated with the project.
    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to check if billing is enabled on a project.

  4. Install git

  5. Install go

  6. Add the following values to your environment settings such as .bashrc:

    # Add GOPATH variable for convenience
    export GOPATH=$(go env GOPATH)
    # Add Go binaries to PATH
    export PATH=$PATH:$(go env GOPATH)/bin
    
  7. Install goimports

    go install golang.org/x/tools/cmd/goimports@latest
    
  8. Install terraform

  9. Clone the magic-modules repository

    cd ~
    git clone https://github.com/GoogleCloudPlatform/magic-modules.git
    
  10. Run the following command from the root of your cloned magic-modules repository.

    cd magic-modules
    ./scripts/doctor
    

    Expected output if everything is installed properly:

    Check for go in path...
       found!
    Check for goimports in path...
       found!
    Check for git in path...
       found!
    Check for terraform in path...
       found!
    Check for make in path...
       found!
    

What’s next #