Skip to content

Commit c02ebf9

Browse files
authored
Adds UnitKind provider for SaasRuntime (#14910)
1 parent b6cb99b commit c02ebf9

File tree

3 files changed

+399
-0
lines changed

3 files changed

+399
-0
lines changed
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
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: UnitKind
16+
description: A UnitKind serves as a template or type definition for a group of Units. Units that belong to the same UnitKind are managed together, follow the same release model, and are typically updated together through rollouts.
17+
base_url: projects/{{project}}/locations/{{location}}/unitKinds
18+
update_mask: true
19+
self_link: projects/{{project}}/locations/{{location}}/unitKinds/{{unit_kind_id}}
20+
create_url: projects/{{project}}/locations/{{location}}/unitKinds?unitKindId={{unit_kind_id}}
21+
update_verb: PATCH
22+
id_format: projects/{{project}}/locations/{{location}}/unitKinds/{{unit_kind_id}}
23+
import_format:
24+
- projects/{{project}}/locations/{{location}}/unitKinds/{{unit_kind_id}}
25+
min_version: beta
26+
examples:
27+
- name: saas_runtime_unit_kind_basic
28+
primary_resource_id: "example"
29+
min_version: 'beta'
30+
vars:
31+
saas_name: example-saas
32+
cluster_unitkind_name: cluster-unitkind
33+
app_unitkind_name: app-unitkind
34+
test_env_vars:
35+
project: 'PROJECT_NAME'
36+
bootstrap_iam:
37+
- member: "serviceAccount:service-{project_number}@gcp-sa-saasservicemgmt.iam.gserviceaccount.com"
38+
role: "roles/saasservicemgmt.serviceAgent"
39+
autogen_async: false
40+
autogen_status: VW5pdEtpbmQ=
41+
parameters:
42+
- name: location
43+
type: String
44+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
45+
immutable: true
46+
url_param_only: true
47+
required: true
48+
- name: unitKindId
49+
type: String
50+
description: The ID value for the new unit kind.
51+
immutable: true
52+
url_param_only: true
53+
required: true
54+
properties:
55+
- name: annotations
56+
type: KeyValueAnnotations
57+
description: |-
58+
Annotations is an unstructured key-value map stored with a resource that
59+
may be set by external tools to store and retrieve arbitrary metadata.
60+
They are not queryable and should be preserved when modifying objects.
61+
62+
More info: https://kubernetes.io/docs/user-guide/annotations
63+
- name: createTime
64+
type: String
65+
description: The timestamp when the resource was created.
66+
output: true
67+
- name: dependencies
68+
type: Array
69+
description: |-
70+
List of other unit kinds that this release will depend on. Dependencies
71+
will be automatically provisioned if not found. Maximum 10.
72+
immutable: true
73+
item_type:
74+
type: NestedObject
75+
properties:
76+
- name: alias
77+
type: String
78+
description: An alias for the dependency. Used for input variable mapping.
79+
required: true
80+
- name: unitKind
81+
type: String
82+
description: The unit kind of the dependency.
83+
immutable: true
84+
required: true
85+
- name: etag
86+
type: String
87+
description: |-
88+
An opaque value that uniquely identifies a version or
89+
generation of a resource. It can be used to confirm that the client
90+
and server agree on the ordering of a resource being written.
91+
output: true
92+
- name: inputVariableMappings
93+
type: Array
94+
description: |-
95+
List of inputVariables for this release that will either be retrieved from
96+
a dependency’s outputVariables, or will be passed on to a dependency’s
97+
inputVariables. Maximum 100.
98+
item_type:
99+
type: NestedObject
100+
properties:
101+
- name: from
102+
type: NestedObject
103+
description: Output variables whose values will be passed on to dependencies
104+
properties:
105+
- name: dependency
106+
type: String
107+
description: Alias of the dependency that the outputVariable will pass its value to
108+
required: true
109+
- name: outputVariable
110+
type: String
111+
description: Name of the outputVariable on the dependency
112+
required: true
113+
- name: to
114+
type: NestedObject
115+
description: Input variables whose values will be passed on to dependencies
116+
properties:
117+
- name: dependency
118+
type: String
119+
description: Alias of the dependency that the inputVariable will pass its value to
120+
required: true
121+
- name: ignoreForLookup
122+
type: Boolean
123+
description: Tells SaaS Runtime if this mapping should be used during lookup or not
124+
- name: inputVariable
125+
type: String
126+
description: Name of the inputVariable on the dependency
127+
required: true
128+
- name: variable
129+
type: String
130+
description: name of the variable
131+
required: true
132+
- name: labels
133+
type: KeyValueLabels
134+
description: |-
135+
The labels on the resource, which can be used for categorization.
136+
similar to Kubernetes resource labels.
137+
- name: name
138+
type: String
139+
description: |-
140+
Identifier. The resource name (full URI of the resource) following the standard naming
141+
scheme:
142+
143+
"projects/{project}/locations/{location}/unitKinds/{unitKind}"
144+
output: true
145+
- name: outputVariableMappings
146+
type: Array
147+
description: |-
148+
List of outputVariables for this unit kind will be passed to this unit's
149+
outputVariables. Maximum 100.
150+
item_type:
151+
type: NestedObject
152+
properties:
153+
- name: from
154+
type: NestedObject
155+
description: Output variables whose values will be passed on to dependencies
156+
properties:
157+
- name: dependency
158+
type: String
159+
description: Alias of the dependency that the outputVariable will pass its value to
160+
required: true
161+
- name: outputVariable
162+
type: String
163+
description: Name of the outputVariable on the dependency
164+
required: true
165+
- name: to
166+
type: NestedObject
167+
description: Input variables whose values will be passed on to dependencies
168+
properties:
169+
- name: dependency
170+
type: String
171+
description: Alias of the dependency that the inputVariable will pass its value to
172+
required: true
173+
- name: ignoreForLookup
174+
type: Boolean
175+
description: Tells SaaS Runtime if this mapping should be used during lookup or not
176+
- name: inputVariable
177+
type: String
178+
description: Name of the inputVariable on the dependency
179+
required: true
180+
- name: variable
181+
type: String
182+
description: name of the variable
183+
required: true
184+
- name: saas
185+
type: String
186+
description: |-
187+
A reference to the Saas that defines the product (managed service) that
188+
the producer wants to manage with SaaS Runtime. Part of the SaaS Runtime
189+
common data model. Immutable once set.
190+
immutable: true
191+
required: true
192+
- name: uid
193+
type: String
194+
description: |-
195+
The unique identifier of the resource. UID is unique in the time
196+
and space for this resource within the scope of the service. It is
197+
typically generated by the server on successful creation of a resource
198+
and must not be changed. UID is used to uniquely identify resources
199+
with resource name reuses. This should be a UUID4.
200+
output: true
201+
- name: updateTime
202+
type: String
203+
description: |-
204+
The timestamp when the resource was last updated. Any
205+
change to the resource made by users must refresh this value.
206+
Changes to a resource made by the service should refresh this value.
207+
output: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
resource "google_saas_runtime_saas" "example_saas" {
2+
provider = google-beta
3+
saas_id = "{{index $.Vars "saas_name"}}"
4+
location = "global"
5+
6+
locations {
7+
name = "us-central1"
8+
}
9+
}
10+
11+
resource "google_saas_runtime_unit_kind" "cluster_unit_kind" {
12+
provider = google-beta
13+
location = "global"
14+
unit_kind_id = "{{index $.Vars "cluster_unitkind_name"}}"
15+
saas = google_saas_runtime_saas.example_saas.id
16+
}
17+
18+
resource "google_saas_runtime_unit_kind" "{{$.PrimaryResourceId}}" {
19+
provider = google-beta
20+
location = "global"
21+
unit_kind_id = "{{index $.Vars "app_unitkind_name"}}"
22+
saas = google_saas_runtime_saas.example_saas.id
23+
24+
dependencies {
25+
unit_kind = google_saas_runtime_unit_kind.cluster_unit_kind.id
26+
alias = "cluster"
27+
}
28+
}

0 commit comments

Comments
 (0)