...
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_project_service" "apigee" {
21 project = data.google_client_config.current.project
22 service = "apigee.googleapis.com"
23}
24
25resource "google_project_service" "compute" {
26 project = data.google_client_config.current.project
27 service = "compute.googleapis.com"
28}
29
30resource "google_project_service" "servicenetworking" {
31 project = data.google_client_config.current.project
32 service = "servicenetworking.googleapis.com"
33}
34
35resource "google_compute_network" "apigee_network" {
36 name = "apigee-network"
37 project = data.google_client_config.current.project
38 depends_on = [ google_project_service.compute ]
39}
40
41resource "google_compute_global_address" "apigee_range" {
42 name = "apigee-range"
43 purpose = "VPC_PEERING"
44 address_type = "INTERNAL"
45 prefix_length = 16
46 network = google_compute_network.apigee_network.id
47 project = data.google_client_config.current.project
48}
49
50resource "google_service_networking_connection" "apigee_vpc_connection" {
51 network = google_compute_network.apigee_network.id
52 service = "servicenetworking.googleapis.com"
53 reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
54}
55
56resource "google_apigee_organization" "org" {
57 analytics_region = "us-central1"
58 project_id = data.google_client_config.current.project
59 authorized_network = google_compute_network.apigee_network.id
60 billing_type = "EVALUATION"
61 depends_on = [
62 google_service_networking_connection.apigee_vpc_connection,
63 google_project_service.apigee
64 ]
65}
66
67resource "google_apigee_addons_config" "test_organization" {
68 org = google_apigee_organization.org.name
69
70 addons_config {
71 integration_config {
72 enabled = true
73 }
74 api_security_config {
75 enabled = true
76 }
77 connectors_platform_config {
78 enabled = true
79 }
80 monetization_config {
81 enabled = true
82 }
83 advanced_api_ops_config {
84 enabled = true
85 }
86 }
87}
88```
View as plain text