Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Terraform für Google Cloud in Cloud Shell und in einer lokalen Shell installieren und konfigurieren.
Cloud Shell ist eine interaktive Shell-Umgebung für Google Cloud, mit der Sie Google Cloud kennenlernen und ausprobieren und Projekte und Ressourcen über Ihren Webbrowser verwalten können.
Cloud Shell
Wenn Sie ein Onlineterminal mit bereits eingerichteter gcloud CLI und Terraform einrichten möchten, aktivieren Sie Cloud Shell.
Unten auf dieser Seite wird eine Cloud Shell-Sitzung gestartet und eine Eingabeaufforderung angezeigt. Das Initialisieren der Sitzung kann einige Sekunden dauern.
Wenn Sie Google Cloud-Ressourcen mit Terraform bereitstellen möchten, müssen Sie die entsprechenden APIs aktivieren:
gcloudservicesenable"API"
Ersetzen Sie API durch die API, die Sie aktivieren möchten.
Wenn Sie Google Cloud-Ressourcen mit Terraform bereitstellen möchten, benötigen Sie Identity and Access Management-Rollen, die für diese Ressourcen spezifisch sind.
Dabei ist API die API, die Sie aktivieren möchten.
Wenn Sie Google Cloud-Ressourcen mit Terraform bereitstellen möchten, benötigen Sie Identity and Access Management-Rollen, die für diese Ressourcen spezifisch sind.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis guide details the process of installing and configuring Terraform for Google Cloud, both in the online Cloud Shell environment and in a local shell.\u003c/p\u003e\n"],["\u003cp\u003eTo get started, you'll need to create or select a Google Cloud project and ensure that billing is enabled for it.\u003c/p\u003e\n"],["\u003cp\u003eProvisioning Google Cloud resources with Terraform requires enabling the relevant APIs and setting up specific Identity and Access Management roles for your user account.\u003c/p\u003e\n"],["\u003cp\u003eVerify that Terraform is correctly installed and operational by executing the \u003ccode\u003eterraform\u003c/code\u003e command in your terminal.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Shell environment comes pre-configured with Terraform and the gcloud CLI, while local shell users will have to install and initialize them.\u003c/p\u003e\n"]]],[],null,["# Install Terraform\n\nThis page describes the steps to install Terraform for\nGoogle Cloud in [Cloud Shell](/shell/docs) and in a local shell.\nCloud Shell is an interactive shell environment for Google Cloud\nthat lets you learn and experiment with Google Cloud and manage your\nprojects and resources from your web browser.\n\nFor a introductory guide to using Terraform with Google Cloud, see the\n[Terraform for Google Cloud Quickstart](/docs/terraform/create-vm-instance). \n\n### Cloud Shell\n\n\n1. To use an online terminal with the gcloud CLI and Terraform\n already set up, activate Cloud Shell:\n\n At the bottom of this page, a Cloud Shell session starts and\n displays a command-line prompt. It can take a few seconds for the session\n to initialize.\n2. Run the following command to verify that Terraform is available:\n\n terraform\n\n The output should be similar to the following: \n\n\n Usage: terraform [global options] \u003csubcommand\u003e [args]\n\n The available commands for execution are listed below.\n The primary workflow commands are given first, followed by\n less common or more advanced commands.\n\n Main commands:\n init Prepare your working directory for other commands\n validate Check whether the configuration is valid\n plan Show changes required by the current configuration\n apply Create or update infrastructure\n destroy Destroy previously-created infrastructure\n\n3. To use Terraform with Google Cloud, you should ensure the\n following tasks are completed within Google Cloud:\n\n - [Create or have a Google Cloud project](/resource-manager/docs/creating-managing-projects).\n - [Enable billing](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project) for the Google Cloud project.\n - [Enable APIs](/apis/docs/getting-started#enabling_apis) for the Google Cloud services you intend to work with.\n - [Set up authentication](/docs/terraform/authentication) for Terraform.\n\n### Local shell\n\n1. Use the [installation instructions](https://developer.hashicorp.com/terraform/tutorials/gcp-get-started/install-cli)\n provided by Terraform.\n\n2. Run the following command to verify that Terraform is available:\n\n terraform\n\n The output should be similar to the following: \n\n\n Usage: terraform [global options] \u003csubcommand\u003e [args]\n\n The available commands for execution are listed below.\n The primary workflow commands are given first, followed by\n less common or more advanced commands.\n\n Main commands:\n init Prepare your working directory for other commands\n validate Check whether the configuration is valid\n plan Show changes required by the current configuration\n apply Create or update infrastructure\n destroy Destroy previously-created infrastructure\n\n3. To use Terraform with Google Cloud, you should ensure the\n following tasks are completed within Google Cloud:\n\n - [Create or have a Google Cloud project](/resource-manager/docs/creating-managing-projects).\n - [Enable billing](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project) for the Google Cloud project.\n - [Enable APIs](/apis/docs/getting-started#enabling_apis) for the Google Cloud services you intend to work with.\n - [Set up authentication](/docs/terraform/authentication) for Terraform.\n\nWhat's next\n-----------\n\n- Work through the [Terraform for Google Cloud quickstart](/docs/terraform/create-vm-instance)\n- Learn about the [basic Terraform commands](/docs/terraform/basic-commands)."]]