Instale o Terraform

Nesta página, descrevemos as etapas para instalar o Terraform para Google Cloud no Cloud Shell e em um shell local. O Cloud Shell é um ambiente shell interativo para Google Cloud que permite aprender e testar o Google Cloud e gerenciar seus projetos e recursos do navegador da Web.

Para um guia introdutório sobre como usar o Terraform com o Google Cloud, consulte o Guia de início rápido do Terraform para Google Cloud .

Cloud Shell

  1. Para usar um terminal on-line com a gcloud CLI e o Terraform já configurados, ative o Cloud Shell:

    Na parte de baixo desta página, uma sessão do Cloud Shell é iniciada e exibe um prompt de linha de comando. A inicialização da sessão pode levar alguns segundos.

  2. Execute o seguinte comando para verificar se o Terraform está disponível:

    terraform
    

    A saída será semelhante a esta:

    
    Usage: terraform [global options] <subcommand> [args]
    
    The available commands for execution are listed below.
    The primary workflow commands are given first, followed by
    less common or more advanced commands.
    
    Main commands:
      init          Prepare your working directory for other commands
      validate      Check whether the configuration is valid
      plan          Show changes required by the current configuration
      apply         Create or update infrastructure
      destroy       Destroy previously-created infrastructure
    
    
  3. Para usar o Terraform com o Google Cloud, verifique se as seguintes tarefas foram concluídas no Google Cloud:

Shell local

  1. Siga as instruções de instalação fornecidas pelo Terraform.

  2. Execute o seguinte comando para verificar se o Terraform está disponível:

    terraform
    

    A saída será semelhante a esta:

    
     Usage: terraform [global options] <subcommand> [args]
    
    The available commands for execution are listed below.
    The primary workflow commands are given first, followed by
    less common or more advanced commands.
    
    Main commands:
      init          Prepare your working directory for other commands
      validate      Check whether the configuration is valid
      plan          Show changes required by the current configuration
      apply         Create or update infrastructure
      destroy       Destroy previously-created infrastructure
    
  3. Para usar o Terraform com o Google Cloud, verifique se as seguintes tarefas foram concluídas no Google Cloud:

A seguir