diff --git a/.github/actions/update-docs/Dockerfile b/.github/actions/update-docs/Dockerfile index 301b018..070ce9f 100644 --- a/.github/actions/update-docs/Dockerfile +++ b/.github/actions/update-docs/Dockerfile @@ -14,7 +14,7 @@ FROM quay.io/terraform-docs/terraform-docs:0.16.0 -RUN apk add --no-cache git +RUN apk add --no-cache git perl COPY ./entrypoint.sh /opt/entrypoint.sh diff --git a/.github/actions/update-docs/entrypoint.sh b/.github/actions/update-docs/entrypoint.sh index aad2143..bbfefb6 100755 --- a/.github/actions/update-docs/entrypoint.sh +++ b/.github/actions/update-docs/entrypoint.sh @@ -16,8 +16,16 @@ set -e +template_string="$(cat .github/actions/update-docs/sample-instructions.template.md)" +export template_string + for TYPE in samples modules; do for D in "$TYPE"/*; do + # set the generic sample instructions if required + perl -i.bkp -0pe 's||$ENV{template_string}|gs;' "$D/README.md" + rm "$D/README.md.bkp" + + # run terraform docs terraform-docs --lockfile=false --hide header --hide requirements markdown table --output-file README.md --output-mode inject "$D" done done diff --git a/.github/actions/update-docs/sample-instructions.template.md b/.github/actions/update-docs/sample-instructions.template.md new file mode 100644 index 0000000..0ca468b --- /dev/null +++ b/.github/actions/update-docs/sample-instructions.template.md @@ -0,0 +1,42 @@ + +## Setup Instructions + +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + diff --git a/README.md b/README.md index 637aecd..4ebf09b 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,15 @@ # Apigee Terraform Modules -This repository provides terraform modules and ready to use end-to-end examples for Apigee. +This repository provides end-to-end sample modules and reusable terraform modules for Apigee. ## Prerequisites -* [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) cli on your PATH in version >= 1.1 (or according to the version constraint in the respective module). +* [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) cli on your PATH in version >= 1.4 (or according to the version constraint in the respective module). -## Modules +## End-To-End Samples -Currently the following modules are a available and can be used either as part of the end-to-end examples or as part of your own scripting: - -* [Apigee X Core](modules/apigee-x-core) Configures a complete Apigee X organization with multiple instances, environment groups, and environments. -* [Apigee X Bridge MIG](modules/apigee-x-bridge-mig) Configures a managed instance group of network bridge GCE instances (VMs) that can be used as a load balancer backend and forward traffic to the internal Apigee X endpoint. -* [Apigee X mTLS MIG](modules/apigee-x-mtls-mig) Configures a managed instance group of Envoy proxies that can be used to terminate mutual TLS and forward traffic to the internal Apigee X endpoint. -* [L7 external LB for MIG](modules/mig-l7xlb) Configures an external HTTPS Cloud Load Balancer that fronts managed instance groups. -* [L4 external LB for MIG](modules/mig-l7xlb) Configures an external TCP Proxy that fronts managed instance groups. -* [Routing Appliance](modules/routing-appliance) Configures a routing appliance and custom routes to overcome transitive peering problems. -* [Northbound PSC Backend](modules/nb-psc-l7xlb) Private Service Connect (PSC) Network Endpoint Group (NEG) backend with an HTTPS external load balancer. -* [Southbound PSC Backend](modules/sb-psc-attachment) Private Service Connect (PSC) service attachment and Apigee endpoint attachment. -* [Development Backend](modules/development-backend) Configures an example HTTP backend and an internal load balancer. -* [NIP.io Development Hostname](modules/nip-development-hostname) Configures an external IP address and hostname based on the IP and the nip.io mechanism as well as a Google-managed SSL certificate. - -## Deploying End-To-End Samples - -Set the project ID where you want your Apigee Organization to be deployed to: - -```sh -PROJECT_ID=my-project-id -``` - -Select one of the available sample deployments: +Sample modules are intended to demonstrate the most common network topologies for Apgiee. The sample modules don't make any assumptions about pre-exsting topologies and create all the required resources from scratch. They can be used as a starting point for your own projects or be edited to work with your existing resources (e.g to reference an existing VPC instead of creating a separate one). * [X Basic](samples/x-basic) for a basic Apigee X setup with the raw instance endpoints exposed as internal IP addresses. * [X with external L7 LB](samples/x-l7xlb) for an Apigee X setup that is exposed via a global external L7 load balancer. @@ -46,40 +25,21 @@ To deploy the sample, first create a copy of the example variables and edit acco * [X with Multi Region](samples/x-multi-region) for an Apigee X setup in a Shared VPC exposed in multiple GCP Regions via a global L7 load balancer. Note that the sample uses an EVAL Apigee X Organization and hence a single Apigee X Instance only. In case you have a PROD Apigee X Organization then you will be able to easily extend the sample accordingly. * [X with IaC Automation Pipeline](samples/x-iac-pipeline) for an IaC Automation Pipeline Apigee X setup in a Shared VPC exposed in multiple GCP Regions via a global L7 load balancer. Note that the sample uses an EVAL Apigee X Organization and hence a single Apigee X Instance only. In case you have a PROD Apigee X Organization then you will be able to easily extend the sample accordingly. -* [Hybrid on GKE (Preview)](samples/hybrid-gke) for an Apigee hybrid setup on Google Kubernetes Engine that uses the new [installation tooling](https://github.com/apigee/apigee-hybrid-install) based on kustomize. +## Reusable Modules -```sh -cd samples/... # Sample from above -cp ./x-demo.tfvars ./my-config.tfvars -``` +The following modules can be used either as part of the end-to-end samples above or as part of your own scripting: -Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: - -```sh -gsutil mb "gs://$PROJECT_ID-tf" - -cat <terraform.tf -terraform { - backend "gcs" { - bucket = "$PROJECT_ID-tf" - prefix = "terraform/state" - } -} -EOF -``` - -Validate your config: - -```sh -terraform init -terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" -``` - -and provision everything (takes roughly 25min): +* [Apigee X Core](modules/apigee-x-core) Configures a complete Apigee X organization with multiple instances, environment groups, and environments. +* [Apigee X Bridge MIG](modules/apigee-x-bridge-mig) Configures a managed instance group of network bridge GCE instances (VMs) that can be used as a load balancer backend and forward traffic to the internal Apigee X endpoint. +* [Apigee X mTLS MIG](modules/apigee-x-mtls-mig) Configures a managed instance group of Envoy proxies that can be used to terminate mutual TLS and forward traffic to the internal Apigee X endpoint. +* [L7 external LB for MIG](modules/mig-l7xlb) Configures an external HTTPS Cloud Load Balancer that fronts managed instance groups. +* [L4 external LB for MIG](modules/mig-l7xlb) Configures an external TCP Proxy that fronts managed instance groups. +* [Routing Appliance](modules/routing-appliance) Configures a routing appliance and custom routes to overcome transitive peering problems. +* [Northbound PSC Backend](modules/nb-psc-l7xlb) Private Service Connect (PSC) Network Endpoint Group (NEG) backend with an HTTPS external load balancer. +* [Southbound PSC Backend](modules/sb-psc-attachment) Private Service Connect (PSC) service attachment and Apigee endpoint attachment. +* [Development Backend](modules/development-backend) Configures an example HTTP backend and an internal load balancer. +* [NIP.io Development Hostname](modules/nip-development-hostname) Configures an external IP address and hostname based on the IP and the nip.io mechanism as well as a Google-managed SSL certificate. -```sh -terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" -``` ## Known issues diff --git a/samples/x-basic/README.md b/samples/x-basic/README.md index 1fd7b6c..ef2db6b 100644 --- a/samples/x-basic/README.md +++ b/samples/x-basic/README.md @@ -1,9 +1,49 @@ # Basic Apigee X Setup with internal Endpoint +A minimal Apigee X setup that uses the internal endpoint to connect to Apigee. + + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-controlled-internet-egress/README.md b/samples/x-controlled-internet-egress/README.md index 79bef6b..b04c578 100644 --- a/samples/x-controlled-internet-egress/README.md +++ b/samples/x-controlled-internet-egress/README.md @@ -13,10 +13,48 @@ gcloud services vpc-peerings enable-vpc-service-controls \ --network=NETWORK --project=PROJECT_ID ``` + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-dns-peering/README.md b/samples/x-dns-peering/README.md index a1d98af..1cbd589 100644 --- a/samples/x-dns-peering/README.md +++ b/samples/x-dns-peering/README.md @@ -10,10 +10,48 @@ A records: * **demo.internal** pointing at the ILB of the demo backend * **${ENV_GROUP_NAME}-api.internal** pointing at all Apigee instance endpoints + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-ilb-mtls/README.md b/samples/x-ilb-mtls/README.md index 4207c45..f22d90c 100644 --- a/samples/x-ilb-mtls/README.md +++ b/samples/x-ilb-mtls/README.md @@ -32,10 +32,48 @@ tls_cert_path = "./certs/server.crt" tls_key_path = "./certs/server.key" ``` + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-l4xlb-mtls/README.md b/samples/x-l4xlb-mtls/README.md index cd1a344..990fe03 100644 --- a/samples/x-l4xlb-mtls/README.md +++ b/samples/x-l4xlb-mtls/README.md @@ -32,13 +32,53 @@ tls_cert_path = "./certs/server.crt" tls_key_path = "./certs/server.key" ``` -## Setup Instructions +### Important Note: Ensure that your tf variables file (.apigee_envgroups.test.hostnames[]) contains the same hostname as you used in the CN of your certificate. -For the rest see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. + +## Setup Instructions + +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Testing diff --git a/samples/x-l7xlb/README.md b/samples/x-l7xlb/README.md index 5bb8b7f..c75d040 100644 --- a/samples/x-l7xlb/README.md +++ b/samples/x-l7xlb/README.md @@ -1,9 +1,50 @@ # Apigee X with External HTTPS Load Balancer +This sample creates a basic Apigee X setup with an external HTTPS load balancer and a MIG backend. + + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + + ## Providers diff --git a/samples/x-multi-region/README.md b/samples/x-multi-region/README.md index 549306b..e7c97a0 100644 --- a/samples/x-multi-region/README.md +++ b/samples/x-multi-region/README.md @@ -1,16 +1,54 @@ # Apigee X exposed in Multiple GCP Regions with Shared VPC and External HTTPS Load Balancer -## Setup Instructions - -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. -

Apigee X Shared VPC Multi Region Sample Architecture

Note that the sample uses an EVAL Apigee X Organization and hence a single Apigee X Instance only. In case you have a PROD Apigee X Organization then you will be able to easily extend the sample accordingly. + +## Setup Instructions + +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + + ## Providers diff --git a/samples/x-nb-psc-l7ilb/README.md b/samples/x-nb-psc-l7ilb/README.md index 75338fa..94b85b4 100644 --- a/samples/x-nb-psc-l7ilb/README.md +++ b/samples/x-nb-psc-l7ilb/README.md @@ -1,3 +1,50 @@ +# Apigee X with PSC and an internal HTTPS load balancer + +This module will create an Apigee X instance that is fronted with an internal HTTPS load balancer and connected via PSC. + + +## Setup Instructions + +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + + ## Providers diff --git a/samples/x-nb-psc-xlb/README.md b/samples/x-nb-psc-xlb/README.md index 7c2b9ee..7c67c3d 100644 --- a/samples/x-nb-psc-xlb/README.md +++ b/samples/x-nb-psc-xlb/README.md @@ -1,9 +1,49 @@ # Apigee X with PSC NEG and External HTTPS Load Balancer +This module will create an Apigee X instance that is fronted with an external HTTPS load balancer that is connected via PSC. + + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-sb-psc/README.md b/samples/x-sb-psc/README.md index 09924df..acfefc9 100644 --- a/samples/x-sb-psc/README.md +++ b/samples/x-sb-psc/README.md @@ -3,10 +3,50 @@ This module provides a southbound private service connect (PSC) connectivity between an Apigee X runtime and a sample backend that is running on a standalone VPC. + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + + +## Validate the setup A successful run will print the endpoint attachment's host that you can then use for your target server in Apigee: diff --git a/samples/x-shared-vpc/README.md b/samples/x-shared-vpc/README.md index 6ef2834..e7dba10 100644 --- a/samples/x-shared-vpc/README.md +++ b/samples/x-shared-vpc/README.md @@ -1,9 +1,49 @@ # Apigee X in Shared VPC with External HTTPS Load Balancer +Apigee X installation in a shared VPC setup and with a an external HTTPS load balancer to route traffic via forwarding MIGs. + + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers diff --git a/samples/x-transitive-peering/README.md b/samples/x-transitive-peering/README.md index 4c626c4..ce6b076 100644 --- a/samples/x-transitive-peering/README.md +++ b/samples/x-transitive-peering/README.md @@ -19,10 +19,48 @@ To validate or demo the setup: 1. Create and ssh into a temporary bastion VM in the backend network or use one of the backend VMs directly. 1. Set the `ENDPOINT_IP` variable to your internal Apigee Endpoint and call the API proxy with: `curl https://test.api.example.com/internal/get --resolve test.api.example.com:443:${ENDPOINT_IP} -kv` + ## Setup Instructions -Please see the main [README](https://github.com/apigee/terraform-modules#deploying-end-to-end-samples) -for detailed instructions. +Set the project ID where you want your Apigee Organization to be deployed to: + +```sh +PROJECT_ID=my-project-id +``` + +```sh +cd samples/... # Sample from above +cp ./x-demo.tfvars ./my-config.tfvars +``` + +Decide on a [backend](https://www.terraform.io/language/settings/backends) and create the necessary config. To use a backend on Google Cloud Storage (GCS) use: + +```sh +gsutil mb "gs://$PROJECT_ID-tf" + +cat <terraform.tf +terraform { + backend "gcs" { + bucket = "$PROJECT_ID-tf" + prefix = "terraform/state" + } +} +EOF +``` + +Validate your config: + +```sh +terraform init +terraform plan --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + +and provision everything (takes roughly 25min): + +```sh +terraform apply --var-file=./my-config.tfvars -var "project_id=$PROJECT_ID" +``` + ## Providers