...
1/**
2 * Copyright 2022 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17```hcl
18data "google_client_config" "current" {}
19
20resource "google_compute_network" "apigee_network" {
21 name = "apigee-network"
22}
23
24resource "google_compute_global_address" "apigee_range" {
25 name = "apigee-range"
26 purpose = "VPC_PEERING"
27 address_type = "INTERNAL"
28 prefix_length = 16
29 network = google_compute_network.apigee_network.id
30}
31
32resource "google_service_networking_connection" "apigee_vpc_connection" {
33 network = google_compute_network.apigee_network.id
34 service = "servicenetworking.googleapis.com"
35 reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
36}
37
38resource "google_apigee_organization" "apigee_org" {
39 analytics_region = "us-central1"
40 project_id = data.google_client_config.current.project
41 authorized_network = google_compute_network.apigee_network.id
42 depends_on = [google_service_networking_connection.apigee_vpc_connection]
43}
44
45resource "google_apigee_instance" "apigee_instance" {
46 name = "my-instance-name"
47 location = "us-central1"
48 org_id = google_apigee_organization.apigee_org.id
49}
50```
View as plain text