Skip to content

Commit bbbf4a3

Browse files
authored
Add google_eventarc_google_api_source resource (#13186)
1 parent 82ce831 commit bbbf4a3

File tree

5 files changed

+698
-4
lines changed

5 files changed

+698
-4
lines changed
+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Copyright 2025 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: GoogleApiSource
16+
base_url: projects/{{project}}/locations/{{location}}/googleApiSources
17+
self_link: projects/{{project}}/locations/{{location}}/googleApiSources/{{google_api_source_id}}
18+
create_url: projects/{{project}}/locations/{{location}}/googleApiSources?googleApiSourceId={{google_api_source_id}}
19+
update_verb: PATCH
20+
update_mask: true
21+
id_format: projects/{{project}}/locations/{{location}}/googleApiSources/{{google_api_source_id}}
22+
import_format:
23+
- projects/{{project}}/locations/{{location}}/googleApiSources/{{google_api_source_id}}
24+
references:
25+
guides:
26+
'Official Documentation': 'https://cloud.google.com/eventarc/advanced/docs/publish-events/publish-events-google-sources'
27+
api: https://cloud.google.com/eventarc/docs/reference/rest/v1/projects.locations.googleApiSources
28+
description: |
29+
The Eventarc GoogleApiSource resource
30+
async:
31+
actions: ['create', 'update', 'delete']
32+
operation:
33+
base_url: '{{op_id}}'
34+
type: OpAsync
35+
result:
36+
resource_inside_response: true
37+
autogen_async: true
38+
examples:
39+
- name: eventarc_google_api_source_with_cmek
40+
primary_resource_id: primary
41+
test_env_vars:
42+
project_name: PROJECT_NAME
43+
# We don't auto-generate tests since we can't support concurrent tests, as long as
44+
# only one GoogleApiSource and MessageBus is supported per project.
45+
exclude_test: true
46+
parameters:
47+
- name: location
48+
type: String
49+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
50+
immutable: true
51+
url_param_only: true
52+
required: true
53+
- name: googleApiSourceId
54+
type: String
55+
description: |-
56+
The user-provided ID to be assigned to the GoogleApiSource. It should match
57+
the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
58+
immutable: true
59+
url_param_only: true
60+
required: true
61+
properties:
62+
- name: updateTime
63+
type: String
64+
description: The last-modified time.
65+
output: true
66+
- name: labels
67+
type: KeyValueLabels
68+
description: Resource labels.
69+
- name: cryptoKeyName
70+
type: String
71+
description: |-
72+
Resource name of a KMS crypto key (managed by the user) used to
73+
encrypt/decrypt their event data.
74+
75+
It must match the pattern
76+
`projects/*/locations/*/keyRings/*/cryptoKeys/*`.
77+
- name: etag
78+
type: String
79+
description: |-
80+
This checksum is computed by the server based on the value of other
81+
fields, and might be sent only on update and delete requests to ensure that
82+
the client has an up-to-date value before proceeding.
83+
output: true
84+
- name: annotations
85+
type: KeyValueAnnotations
86+
description: Resource annotations.
87+
- name: displayName
88+
type: String
89+
description: Resource display name.
90+
- name: destination
91+
type: String
92+
description: |-
93+
Destination is the message bus that the GoogleApiSource is delivering to.
94+
It must be point to the full resource name of a MessageBus. Format:
95+
"projects/{PROJECT_ID}/locations/{region}/messagesBuses/{MESSAGE_BUS_ID)
96+
required: true
97+
- name: loggingConfig
98+
type: NestedObject
99+
description: |-
100+
The configuration for Platform Telemetry logging for Eventarc Advanced
101+
resources.
102+
default_from_api: true
103+
properties:
104+
- name: logSeverity
105+
type: Enum
106+
description: |-
107+
The minimum severity of logs that will be sent to Stackdriver/Platform
108+
Telemetry. Logs at severitiy ≥ this value will be sent, unless it is NONE.
109+
default_from_api: true
110+
enum_values:
111+
- NONE
112+
- DEBUG
113+
- INFO
114+
- NOTICE
115+
- WARNING
116+
- ERROR
117+
- CRITICAL
118+
- ALERT
119+
- EMERGENCY
120+
- name: name
121+
type: String
122+
description: |-
123+
Resource name of the form
124+
projects/{project}/locations/{location}/googleApiSources/{google_api_source}
125+
output: true
126+
- name: uid
127+
type: String
128+
description: |-
129+
Server assigned unique identifier for the channel. The value is a UUID4
130+
string and guaranteed to remain unchanged until the resource is deleted.
131+
output: true
132+
- name: createTime
133+
type: String
134+
description: The creation time.
135+
output: true

mmv1/products/eventarc/MessageBus.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ properties:
7878
Optional. The minimum severity of logs that will be sent to Stackdriver/Platform
7979
Telemetry. Logs at severitiy ≥ this value will be sent, unless it is NONE.
8080
default_from_api: true
81-
required: true
8281
enum_values:
8382
- NONE
8483
- DEBUG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
data "google_project" "test_project" {
2+
project_id = "{{index $.TestEnvVars "project_name"}}"
3+
}
4+
5+
data "google_kms_key_ring" "test_key_ring" {
6+
name = "keyring"
7+
location = "us-central1"
8+
}
9+
10+
data "google_kms_crypto_key" "key" {
11+
name = "key"
12+
key_ring = data.google_kms_key_ring.test_key_ring.id
13+
}
14+
15+
resource "google_kms_crypto_key_iam_member" "key_member" {
16+
crypto_key_id = data.google_kms_crypto_key.key.id
17+
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
18+
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
19+
}
20+
21+
resource "google_eventarc_message_bus" "message_bus" {
22+
location = "us-central1"
23+
message_bus_id = "some-message-bus"
24+
}
25+
26+
resource "google_eventarc_google_api_source" "{{$.PrimaryResourceId}}" {
27+
location = "us-central1"
28+
google_api_source_id = "some-google-api-source"
29+
destination = google_eventarc_message_bus.message_bus.id
30+
crypto_key_name = data.google_kms_crypto_key.key.id
31+
depends_on = [google_kms_crypto_key_iam_member.key_member]
32+
}

0 commit comments

Comments
 (0)