Skip to content

Commit 7be7590

Browse files
author
Akshay Pai
committed
Add ControlPlaneAccess support for Apigee
1 parent e055e09 commit 7be7590

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 2024 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: 'ControlPlaneAccess'
16+
api_resource_type_kind: Organization
17+
description: |
18+
Authorize the Runtime components to access directly with Apigee Control Plane.
19+
references:
20+
guides:
21+
'Enable ControlPlane access': 'https://cloud.google.com/apigee/docs/hybrid/v1.14/install-enable-control-plane-access'
22+
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations/updateControlPlaneAccess'
23+
docs:
24+
id_format: 'organizations/{{name}}/controlPlaneAccess'
25+
base_url: ''
26+
self_link: 'organizations/{{name}}/controlPlaneAccess'
27+
create_url: 'organizations/{{name}}/controlPlaneAccess'
28+
update_url: 'organizations/{{name}}/controlPlaneAccess'
29+
create_verb: 'PATCH'
30+
update_verb: 'PATCH'
31+
update_mask: true
32+
exclude_delete: true
33+
import_format:
34+
- 'organizations/{{name}}/controlPlaneAccess'
35+
timeouts:
36+
insert_minutes: 20
37+
update_minutes: 20
38+
delete_minutes: 20
39+
custom_code:
40+
examples:
41+
- name: 'apigee_control_plane_access_basic_test'
42+
primary_resource_id: 'apigee_control_plane_access'
43+
vars:
44+
account_id: 'my-account'
45+
project_id: 'my-project'
46+
test_env_vars:
47+
org_id: 'ORG_ID'
48+
billing_account: 'BILLING_ACCT'
49+
parameters:
50+
- name: 'name'
51+
type: String
52+
description: |
53+
Name of the Apigee organization.
54+
url_param_only: true
55+
required: true
56+
immutable: true
57+
properties:
58+
- name: 'synchronizer_identities'
59+
type: Array
60+
description: |
61+
Array of service accounts to grant access to control plane resources (for the Synchronizer component), each specified using the following format: `serviceAccount:service-account-name`.
62+
63+
The `service-account-name` is formatted like an email address. For example: serviceAccount@my_project_id.iam.gserviceaccount.com
64+
65+
You might specify multiple service accounts, for example, if you have multiple environments and wish to assign a unique service account to each one.
66+
67+
The service accounts must have **Apigee Synchronizer Manager** role. See also [Create service accounts](https://cloud.google.com/apigee/docs/hybrid/v1.8/sa-about#create-the-service-accounts).
68+
required: false
69+
send_empty_value: true
70+
item_type:
71+
type: String
72+
- name: 'analytics_publisher_identities'
73+
type: Array
74+
description: |
75+
Array of service accounts authorized to publish analytics data to the control plane, each specified using the following format: `serviceAccount:service-account-name`.
76+
77+
The `service-account-name` is formatted like an email address. For example: serviceAccount@my_project_id.iam.gserviceaccount.com
78+
79+
You might specify multiple service accounts, for example, if you have multiple environments and wish to assign a unique service account to each one.
80+
required: false
81+
send_empty_value: true
82+
item_type:
83+
type: String
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
resource "google_project" "project" {
2+
project_id = "{{index $.Vars "project_id"}}"
3+
name = "{{index $.Vars "project_id"}}"
4+
org_id = "{{index $.TestEnvVars "org_id"}}"
5+
billing_account = "{{index $.TestEnvVars "billing_account"}}"
6+
deletion_policy = "DELETE"
7+
}
8+
9+
resource "google_project_service" "apigee" {
10+
project = google_project.project.project_id
11+
service = "apigee.googleapis.com"
12+
}
13+
14+
resource "google_apigee_organization" "apigee_org" {
15+
analytics_region = "us-central1"
16+
project_id = google_project.project.project_id
17+
18+
runtime_type = "HYBRID"
19+
depends_on = [google_project_service.apigee]
20+
}
21+
22+
resource "google_service_account" "service_account" {
23+
account_id = "{{index $.Vars "account_id"}}"
24+
display_name = "Service Account"
25+
}
26+
27+
resource "google_project_iam_member" "synchronizer-iam" {
28+
project = google_project.project.project_id
29+
role = "roles/apigee.synchronizerManager"
30+
member = "serviceAccount:${google_service_account.service_account.email}"
31+
}
32+
33+
resource "google_apigee_control_plane_access" "{{$.PrimaryResourceId}}" {
34+
name = google_apigee_organization.apigee_org.name
35+
synchronizer_identities = [
36+
"serviceAccount:${google_service_account.service_account.email}",
37+
]
38+
analytics_publisher_identities = [
39+
"serviceAccount:${google_service_account.service_account.email}",
40+
]
41+
depends_on = [google_project_iam_member.synchronizer-iam]
42+
}

0 commit comments

Comments
 (0)