Installa Terraform

Questa pagina descrive i passaggi per installare Terraform perGoogle Cloud Cloud Shell e in una shell locale. Cloud Shell è un ambiente shell interattivo per Google Cloud che ti consente di imparare e fare esperimenti con Google Cloud e gestire i tuoi progetti e le tue risorse dal browser web.

Per una guida introduttiva all'utilizzo di Terraform con Google Cloud, consulta la guida introduttiva a Terraform per Google Cloud .

Cloud Shell

  1. Per utilizzare un terminale online con l'interfaccia a riga di comando gcloud e Terraform già configurati, attiva Cloud Shell:

    Nella parte inferiore di questa pagina viene avviata una sessione Cloud Shell e visualizzato un prompt della riga di comando. L'inizializzazione della sessione può richiedere alcuni secondi.

  2. Esegui il comando seguente per verificare che Terraform sia disponibile:

    terraform
    

    L'output dovrebbe essere simile al seguente:

    
    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. Per utilizzare Terraform con Google Cloud, devi assicurarti di completare le seguenti attività in Google Cloud:

Shell locale

  1. Utilizza le istruzioni di installazione fornite da Terraform.

  2. Esegui il comando seguente per verificare che Terraform sia disponibile:

    terraform
    

    L'output dovrebbe essere simile al seguente:

    
     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. Per utilizzare Terraform con Google Cloud, devi assicurarti di completare le seguenti attività in Google Cloud:

Passaggi successivi