Einige oder alle Informationen auf dieser Seite gelten möglicherweise nicht für Trusted Cloud von S3NS.
Artifact Registry-Ressourcen mit Terraform bereitstellen
HashiCorp Terraform ist ein IaC-Tool (Infrastructure as Code), mit dem Sie eine Cloud-Infrastruktur bereitstellen und verwalten können. Terraform bietet Plug-ins, die als Anbieter bezeichnet werden und mit denen Sie mit Cloud-Anbietern und anderen APIs interagieren können. Sie können den Terraform-Provider für Trusted Cloud verwenden, um Trusted Cloud by S3NS -Ressourcen wie Artifact Registry bereitzustellen und zu verwalten.
Auf dieser Seite wird die Verwendung von Terraform mit Artifact Registry vorgestellt. Sie enthält eine Einführung in die Funktionsweise von Terraform und einige Ressourcen, die Ihnen den Einstieg in die Verwendung von Terraform mit Trusted Clouderleichtern. Außerdem finden Sie Links zur Terraform-Referenzdokumentation für Artifact Registry, Codebeispiele und Anleitungen zur Bereitstellung von Artifact Registry-Ressourcen mit Terraform.
Eine Anleitung für die ersten Schritte mit Terraform für Trusted Cloudfinden Sie unter Terraform installieren und konfigurieren oder im Terraform-Schnellstart für Trusted Cloud .
Terraform hat eine deklarative, konfigurationsorientierte Syntax, mit der Sie die Infrastruktur beschreiben können, die Sie in Ihrem Trusted Cloud -Projekt bereitstellen möchten. Nachdem Sie diese Konfiguration in einer oder mehreren Terraform-Konfigurationsdateien erstellt haben, können Sie die Konfiguration mit der Terraform-Befehlszeile auf Ihre Artifact Registry-Ressourcen anwenden.
In den folgenden Schritten wird die Funktionsweise von Terraform erläutert:
- Sie beschreiben die Infrastruktur, die Sie bereitstellen möchten, in einer Terraform-Konfigurationsdatei. Sie müssen keinen Code schreiben, der beschreibt, wie die Infrastruktur bereitgestellt wird. Terraform stellt die Infrastruktur für Sie bereit.
- Sie führen den Befehl
terraform plan
aus, der Ihre Konfiguration auswertet und einen Ausführungsplan generiert. Sie können den Plan prüfen und bei Bedarf Änderungen vornehmen.
-
Anschließend führen Sie den Befehl terraform apply
aus, der die folgenden Aktionen ausführt:
- Ihre Infrastruktur wird basierend auf Ihrem Ausführungsplan bereitgestellt, indem die entsprechenden Artifact Registry APIs im Hintergrund aufgerufen werden.
- Es wird eine Terraform-Zustandsdatei erstellt, eine JSON-Datei, die die Ressourcen in Ihrer Konfigurationsdatei den Ressourcen in der realen Infrastruktur zuordnet. Terraform verwendet diese Datei, um den aktuellen Status Ihrer Infrastruktur zu erfassen und zu bestimmen, wann Ressourcen erstellt, aktualisiert und gelöscht werden müssen.
-
Wenn Sie anschließend terraform apply
ausführen, verwendet Terraform die Zuordnung in der Zustandsdatei, um die vorhandene Infrastruktur mit dem Code zu vergleichen und bei Bedarf Aktualisierungen vorzunehmen:
- Wenn ein Ressourcenobjekt in der Konfigurationsdatei definiert, aber in der Zustandsdatei nicht vorhanden ist, wird es von Terraform erstellt.
- Wenn ein Ressourcenobjekt in der Zustandsdatei vorhanden ist, aber eine andere Konfiguration als die Konfigurationsdatei hat, aktualisiert Terraform die Ressource entsprechend Ihrer Konfigurationsdatei.
- Wenn ein Ressourcenobjekt in der Zustandsdatei mit der Konfigurationsdatei übereinstimmt, lässt Terraform die Ressource unverändert.
Terraform-Ressourcen für Artifact Registry
Ressourcen sind die grundlegenden Elemente der Terraform-Sprache. Jeder Ressourcenblock beschreibt ein oder mehrere Infrastrukturobjekte, z. B. virtuelle Netzwerke oder Compute-Instanzen.
In der folgenden Tabelle sind die Terraform-Ressourcen aufgeführt, die für Artifact Registry verfügbar sind:
Terraform-basierte Anleitungen für Artifact Registry
In der folgenden Tabelle sind Terraform-basierte Anleitungen und Tutorials für Artifact Registry aufgeführt:
Terraform-Module und -Blueprints für Artifact Registry
Mithilfe von Modulen und Blueprints können Sie die Bereitstellung und Verwaltung von Trusted Cloud -Ressourcen in großem Maßstab automatisieren. Ein Modul ist ein wiederverwendbarer Satz von Terraform-Konfigurationsdateien, der eine logische Abstraktion von Terraform-Ressourcen erstellt. Ein Blueprint ist ein Paket aus bereitstellbaren und wiederverwendbaren Modulen und einer Richtlinie, mit der eine bestimmte Lösung implementiert und dokumentiert wird.
In der folgenden Tabelle sind Module und Blueprints aufgeführt, die mit Artifact Registry in Verbindung stehen:
Modul oder Blueprint |
Details |
artifact-registry |
Artifact Registry-Repositories erstellen und verwalten |
gcloud |
Führt Trusted Cloud by S3NS CLI-Befehle in Terraform aus |
Nächste Schritte
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-08-25 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-25 (UTC)."],[[["\u003cp\u003eTerraform is an infrastructure-as-code tool used to provision and manage cloud infrastructure, including Google Cloud resources like Artifact Registry, through its declarative configuration files and providers.\u003c/p\u003e\n"],["\u003cp\u003eUsing the Terraform CLI, you describe your desired infrastructure in configuration files, then use \u003ccode\u003eterraform plan\u003c/code\u003e to review an execution plan and \u003ccode\u003eterraform apply\u003c/code\u003e to provision resources and manage their state.\u003c/p\u003e\n"],["\u003cp\u003eTerraform's state file maintains a record of your infrastructure's current state, enabling it to create, update, or leave resources unchanged by comparing the existing infrastructure to your configuration code.\u003c/p\u003e\n"],["\u003cp\u003eTerraform resources for Artifact Registry include managing repositories, IAM, and VPC-SC configurations, while data sources include information on Docker images and repository IAM policies.\u003c/p\u003e\n"],["\u003cp\u003eTerraform modules and blueprints for Artifact Registry provide reusable sets of configurations to automate the provisioning and management of Google Cloud resources, allowing for standardized and efficient infrastructure deployment.\u003c/p\u003e\n"]]],[],null,["# Provision Artifact Registry resources with Terraform\n\nHashiCorp Terraform is an infrastructure-as-code (IaC) tool that lets you\nprovision and manage cloud infrastructure. Terraform provides plugins called\n*providers* that let you interact with cloud providers and other APIs. You can\nuse the *Terraform provider for Google Cloud* to provision and manage\nGoogle Cloud resources, including Artifact Registry.\n\nThis page introduces you to using Terraform with Artifact Registry, including an\nintroduction to how Terraform works and some resources to help you get started using\nTerraform with Google Cloud. You'll also find links to Terraform reference docs for\nArtifact Registry, code examples, and guides for using Terraform to provision\nArtifact Registry resources.\n\nFor instructions on how to get started with Terraform for Google Cloud, see\n[Install and configure Terraform](/docs/terraform/install-configure-terraform) or the\n[Terraform for Google Cloud quickstart](/docs/terraform/create-vm-instance).\n\nHow Terraform works\n-------------------\n\nTerraform has a declarative and configuration-oriented syntax, which you can\nuse to describe the infrastructure that you want to provision in your\nGoogle Cloud project. After you author this configuration in one or more\nTerraform configuration files, you can use the Terraform CLI to apply this\nconfiguration to your Artifact Registry resources.\n\nThe following steps explain how Terraform works:\n\n1. You describe the infrastructure you want to provision in a *Terraform\n configuration file*. You don't need to write code describing how to provision the infrastructure. Terraform provisions the infrastructure for you.\n2. You run the `terraform plan` command, which evaluates your configuration and generates an execution plan. You can review the plan and make changes as needed.\n3. You run the `terraform apply` command, which performs the following\n actions:\n\n 1. It provisions your infrastructure based on your execution plan by invoking the corresponding Artifact Registry APIs in the background.\n 2. It creates a *Terraform state file*, which is a JSON file that maps the resources in your configuration file to the resources in the real-world infrastructure. Terraform uses this file to keep a record of the most recent state of your infrastructure, and to determine when to create, update, and destroy resources.\n 3. When you run `terraform apply`, Terraform uses the mapping in\n the state file to compare the existing infrastructure to the code, and make\n updates as necessary:\n\n - If a resource object is defined in the configuration file, but doesn't exist in the state file, Terraform creates it.\n - If a resource object exists in the state file, but has a different configuration from your configuration file, Terraform updates the resource to match your configuration file.\n - If a resource object in the state file matches your configuration file, Terraform leaves the resource unchanged.\n\nTerraform resources for Artifact Registry\n-----------------------------------------\n\n*Resources* are the fundamental elements in the Terraform language. Each\nresource block describes one or more infrastructure objects, such as virtual\nnetworks or compute instances.\n\nThe following table lists the Terraform resources available for\nArtifact Registry:\n\n\n\u003cbr /\u003e\n\nTerraform-based guides for Artifact Registry\n--------------------------------------------\n\nThe following table lists Terraform-based how-to guides and tutorials for\nArtifact Registry:\n\n\n\u003cbr /\u003e\n\nTerraform modules and blueprints for Artifact Registry\n------------------------------------------------------\n\nModules and blueprints help you automate provisioning and managing of\nGoogle Cloud resources at scale. A *module* is a\nreusable set of Terraform configuration files that creates a logical abstraction\nof Terraform resources. A *blueprint* is a package of deployable and reusable\nmodules, and a policy that implements and documents a specific solution.\n\nThe following table lists modules and blueprints related to\nArtifact Registry:\n\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Terraform code samples for Artifact Registry](/docs/samples?language=terraform)\n- [Terraform on Google Cloud documentation](/docs/terraform)\n- [Google Cloud provider documentation in HashiCorp](https://registry.terraform.io/providers/hashicorp/google/latest/docs)\n- [Infrastructure as code for Google Cloud](/docs/terraform/iac-overview)"]]