Apigee で Terraform を使用する

Terraform は、コードを使用して Apigee のプロビジョニングと構成を行うことができる Infrastructure as Code(IaC)ツールです。

Apigee で Terraform を使用する場合は、希望するプロビジョニングまたは機能の構成を記述した Terraform ファイルを作成します。構成を適用すると、Terraform は実行プランを作成し、Apigee の構成に必要なオペレーションを実行します。

このページでは、Apigee で使用できる Terraform の機能の概要について説明します。 Google Cloudで Terraform を使用する場合の一般的な情報については、 Google Cloud の Terraform 関連ドキュメントをご覧ください。

始める前に

Apigee プロジェクト用に Terraform を設定するには:

  1. 開発環境を準備します。Cloud Shell またはローカルシェルを選択します。

    Cloud Shell

    gcloud CLI と Terraform を設定済みのオンライン ターミナルを使用するには、Cloud Shell を有効にします。

    このページの下部で Cloud Shell セッションが開始され、コマンドライン プロンプトが表示されます。セッションが初期化されるまで数秒かかることがあります。

    Cloud Shell には Terraform がすでに統合されています。

    ローカルシェル

    ローカル開発環境を使用する手順は次のとおりです。

    1. Install the Google Cloud CLI.

    2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

    3. To initialize the gcloud CLI, run the following command:

      gcloud init
    4. Terraform をインストールします。
  2. Verify that billing is enabled for your Google Cloud project.

  3. Enable the Cloud Resource Manager and Identity, Access Management (IAM) APIs:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable cloudresourcemanager.googleapis.com  iam.googleapis.com
  4. Google Cloud プロジェクトに Google Cloud Platform - Resource Location Restriction 組織のポリシーの制約が追加されていないことを確認します。

Apigee の Terraform リソース

次の表に、Apigee の Terraform リソースを使用して管理できる機能の概要を示します。一部の機能はリストに表示されていない場合があります。すべての Apigee の Terraform リソースは、Apigee Terraform GitHub リポジトリで確認できます。最新の機能については、必ず GitHub リポジトリを確認してください。

Apigee の機能 Terraform のサポートの概要 詳細情報
Apigee をプロビジョニングする Terraform を使用して Apigee インスタンスをプロビジョニングします。 プロビジョニングのオプション
Apigee API ハブをプロビジョニングする Terraform を使用して API ハブを構成、管理します。 Terraform を使用して API ハブをプロビジョニングする
Advanced API Security を構成する セキュリティ アクションとリスク評価 v2 の一部の側面を構成します。 Terraform を使用して Advanced API Security を構成する