Apigee で Terraform を使用する

Terraform は、コードを使用して Apigee をプロビジョニングして構成するために使用できる Infrastructure as Code(IaC)ツールです。

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

このページでは、Apigee で使用できる Terraform の機能について説明します。Terraform で Google Cloudを使用する場合の一般的な情報については、 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 Hub をプロビジョニングする Terraform を使用して API Hub を構成して管理する。 Terraform を使用して API Hub をプロビジョニングする
Advanced API Security を構成する セキュリティ アクションとリスク評価 v2 の一部の側面を構成します。 Terraform を使用して Advanced API Security を構成する