Skip to content

Commit 3c3d3e9

Browse files
committed
feat: (beta) Add Hierarchical Service Activation
1 parent 6335edf commit 3c3d3e9

16 files changed

+869
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Copyright 2026 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: 'ConsumerPolicy'
16+
description: |
17+
Consumer Policy is a set of rules that define what services or service groups
18+
can be used for a cloud resource hierarchy. This resource manages the consumer
19+
policy for a project as part of Hierarchical Service Activation.
20+
min_version: 'beta'
21+
references:
22+
guides:
23+
'Hierarchical Service Activation Overview': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/overview'
24+
'Manage service enablement': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/manage-enablement'
25+
api: 'https://cloud.google.com/service-usage/docs/reference/rest/v2beta/consumerPolicies'
26+
docs:
27+
warning: |
28+
This resource is in beta, and should be used with the terraform-provider-google-beta provider.
29+
Hierarchical Service Activation is a Preview feature.
30+
base_url: 'projects/{{project}}/consumerPolicies'
31+
self_link: 'projects/{{project}}/consumerPolicies/default'
32+
create_url: 'projects/{{project}}/consumerPolicies/default'
33+
create_verb: 'PATCH'
34+
update_url: 'projects/{{project}}/consumerPolicies/default'
35+
update_verb: 'PATCH'
36+
delete_verb: 'PATCH'
37+
id_format: 'projects/{{project}}/consumerPolicies/default'
38+
import_format:
39+
- 'projects/{{project}}/consumerPolicies/default'
40+
- '{{project}}'
41+
timeouts:
42+
insert_minutes: 20
43+
update_minutes: 20
44+
delete_minutes: 20
45+
autogen_async: true
46+
async:
47+
actions: ['create', 'update']
48+
type: 'OpAsync'
49+
operation:
50+
base_url: '{{op_id}}'
51+
result:
52+
resource_inside_response: true
53+
exclude_sweeper: true
54+
custom_code:
55+
custom_update: 'templates/terraform/custom_update/consumer_policy.go.tmpl'
56+
custom_delete: 'templates/terraform/custom_delete/clear_consumer_policy.go.tmpl'
57+
test_check_destroy: 'templates/terraform/custom_check_destroy/consumer_policy.go.tmpl'
58+
examples:
59+
- name: 'service_usage_consumer_policy_basic'
60+
primary_resource_id: 'default'
61+
min_version: 'beta'
62+
vars:
63+
# No vars needed, uses default project
64+
test_env_vars:
65+
project: 'PROJECT_NAME'
66+
parameters:
67+
- name: 'force'
68+
type: Boolean
69+
description: |
70+
If force is set to true, the policy update will proceed even if it may result
71+
in the deletion of resources from affected services or loss of API access for
72+
clients. This is required when disabling services that have been used in the
73+
last 30 days or were enabled in the past 3 days. Without force, such changes
74+
will return an error.
75+
min_version: 'beta'
76+
url_param_only: true
77+
default_value: false
78+
properties:
79+
- name: 'name'
80+
type: String
81+
description: |
82+
Output only. The resource name of the policy.
83+
Format: `projects/{project}/consumerPolicies/default`
84+
min_version: 'beta'
85+
output: true
86+
- name: 'etag'
87+
type: String
88+
description: |
89+
An opaque tag indicating the current version of the policy, used for concurrency control.
90+
min_version: 'beta'
91+
output: true
92+
- name: 'createTime'
93+
type: Time
94+
description: |
95+
Output only. The time the policy was created.
96+
min_version: 'beta'
97+
output: true
98+
- name: 'updateTime'
99+
type: Time
100+
description: |
101+
Output only. The time the policy was last updated.
102+
min_version: 'beta'
103+
output: true
104+
- name: 'enableRules'
105+
type: Array
106+
description: |
107+
Enable rules define usable services and service groups.
108+
min_version: 'beta'
109+
item_type:
110+
type: NestedObject
111+
properties:
112+
- name: 'services'
113+
type: Array
114+
description: |
115+
The names of the services that are enabled.
116+
Example: `services/storage.googleapis.com`
117+
min_version: 'beta'
118+
item_type:
119+
type: String
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Copyright 2026 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: 'ConsumerPolicyForFolder'
16+
api_resource_type_kind: ConsumerPolicy
17+
description: |
18+
Consumer Policy is a set of rules that define what services or service groups
19+
can be used for a cloud resource hierarchy. This resource manages the consumer
20+
policy for a folder as part of Hierarchical Service Activation.
21+
min_version: 'beta'
22+
references:
23+
guides:
24+
'Hierarchical Service Activation Overview': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/overview'
25+
'Manage service enablement': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/manage-enablement'
26+
api: 'https://cloud.google.com/service-usage/docs/reference/rest/v2beta/consumerPolicies'
27+
docs:
28+
warning: |
29+
This resource is in beta, and should be used with the terraform-provider-google-beta provider.
30+
Hierarchical Service Activation is a Preview feature.
31+
base_url: 'folders/{{folder}}/consumerPolicies'
32+
self_link: 'folders/{{folder}}/consumerPolicies/default'
33+
create_url: 'folders/{{folder}}/consumerPolicies/default'
34+
create_verb: 'PATCH'
35+
update_url: 'folders/{{folder}}/consumerPolicies/default'
36+
update_verb: 'PATCH'
37+
delete_verb: 'PATCH'
38+
id_format: 'folders/{{folder}}/consumerPolicies/default'
39+
import_format:
40+
- 'folders/{{folder}}/consumerPolicies/default'
41+
timeouts:
42+
insert_minutes: 20
43+
update_minutes: 20
44+
delete_minutes: 20
45+
autogen_async: true
46+
async:
47+
actions: ['create', 'update']
48+
type: 'OpAsync'
49+
operation:
50+
base_url: '{{op_id}}'
51+
result:
52+
resource_inside_response: true
53+
include_project: true
54+
exclude_sweeper: true
55+
custom_code:
56+
custom_update: 'templates/terraform/custom_update/consumer_policy_for_folder.go.tmpl'
57+
custom_delete: 'templates/terraform/custom_delete/clear_consumer_policy_for_folder.go.tmpl'
58+
test_check_destroy: 'templates/terraform/custom_check_destroy/consumer_policy_for_folder.go.tmpl'
59+
examples:
60+
- name: 'service_usage_consumer_policy_folder_basic'
61+
primary_resource_id: 'default'
62+
min_version: 'beta'
63+
vars:
64+
folder_name: 'test-folder'
65+
test_env_vars:
66+
org_id: 'ORG_ID'
67+
parameters:
68+
- name: 'folder'
69+
type: String
70+
description: |
71+
The folder ID for the consumer policy.
72+
min_version: 'beta'
73+
url_param_only: true
74+
required: true
75+
immutable: true
76+
- name: 'force'
77+
type: Boolean
78+
description: |
79+
If force is set to true, the policy update will proceed even if it may result
80+
in the deletion of resources from affected services or loss of API access for
81+
clients. This is required when disabling services that have been used in the
82+
last 30 days or were enabled in the past 3 days. Without force, such changes
83+
will return an error.
84+
min_version: 'beta'
85+
url_param_only: true
86+
default_value: false
87+
properties:
88+
- name: 'name'
89+
type: String
90+
description: |
91+
Output only. The resource name of the policy.
92+
Format: `folders/{folder}/consumerPolicies/default`
93+
min_version: 'beta'
94+
output: true
95+
- name: 'etag'
96+
type: String
97+
description: |
98+
An opaque tag indicating the current version of the policy, used for concurrency control.
99+
min_version: 'beta'
100+
output: true
101+
- name: 'createTime'
102+
type: Time
103+
description: |
104+
Output only. The time the policy was created.
105+
min_version: 'beta'
106+
output: true
107+
- name: 'updateTime'
108+
type: Time
109+
description: |
110+
Output only. The time the policy was last updated.
111+
min_version: 'beta'
112+
output: true
113+
- name: 'enableRules'
114+
type: Array
115+
description: |
116+
Enable rules define usable services and service groups.
117+
min_version: 'beta'
118+
item_type:
119+
type: NestedObject
120+
properties:
121+
- name: 'services'
122+
type: Array
123+
description: |
124+
The names of the services that are enabled.
125+
Example: `services/storage.googleapis.com`
126+
min_version: 'beta'
127+
item_type:
128+
type: String
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Copyright 2026 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: 'ConsumerPolicyForOrganization'
16+
api_resource_type_kind: ConsumerPolicy
17+
description: |
18+
Consumer Policy is a set of rules that define what services or service groups
19+
can be used for a cloud resource hierarchy. This resource manages the consumer
20+
policy for an organization as part of Hierarchical Service Activation.
21+
min_version: 'beta'
22+
references:
23+
guides:
24+
'Hierarchical Service Activation Overview': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/overview'
25+
'Manage service enablement': 'https://cloud.google.com/service-usage/docs/hierarchical-service-activation/manage-enablement'
26+
api: 'https://cloud.google.com/service-usage/docs/reference/rest/v2beta/consumerPolicies'
27+
docs:
28+
warning: |
29+
This resource is in beta, and should be used with the terraform-provider-google-beta provider.
30+
Hierarchical Service Activation is a Preview feature.
31+
base_url: 'organizations/{{organization}}/consumerPolicies'
32+
self_link: 'organizations/{{organization}}/consumerPolicies/default'
33+
create_url: 'organizations/{{organization}}/consumerPolicies/default'
34+
create_verb: 'PATCH'
35+
update_url: 'organizations/{{organization}}/consumerPolicies/default'
36+
update_verb: 'PATCH'
37+
delete_verb: 'PATCH'
38+
id_format: 'organizations/{{organization}}/consumerPolicies/default'
39+
import_format:
40+
- 'organizations/{{organization}}/consumerPolicies/default'
41+
timeouts:
42+
insert_minutes: 20
43+
update_minutes: 20
44+
delete_minutes: 20
45+
autogen_async: true
46+
async:
47+
actions: ['create', 'update']
48+
type: 'OpAsync'
49+
operation:
50+
base_url: '{{op_id}}'
51+
result:
52+
resource_inside_response: true
53+
include_project: true
54+
exclude_sweeper: true
55+
custom_code:
56+
custom_update: 'templates/terraform/custom_update/consumer_policy_for_organization.go.tmpl'
57+
custom_delete: 'templates/terraform/custom_delete/clear_consumer_policy_for_organization.go.tmpl'
58+
test_check_destroy: 'templates/terraform/custom_check_destroy/consumer_policy_for_organization.go.tmpl'
59+
examples:
60+
- name: 'service_usage_consumer_policy_organization_basic'
61+
primary_resource_id: 'default'
62+
min_version: 'beta'
63+
vars: {}
64+
test_env_vars:
65+
org_id: 'ORG_ID'
66+
parameters:
67+
- name: 'organization'
68+
type: String
69+
description: |
70+
The organization ID for the consumer policy.
71+
min_version: 'beta'
72+
url_param_only: true
73+
required: true
74+
immutable: true
75+
- name: 'force'
76+
type: Boolean
77+
description: |
78+
If force is set to true, the policy update will proceed even if it may result
79+
in the deletion of resources from affected services or loss of API access for
80+
clients. This is required when disabling services that have been used in the
81+
last 30 days or were enabled in the past 3 days. Without force, such changes
82+
will return an error.
83+
min_version: 'beta'
84+
url_param_only: true
85+
default_value: false
86+
properties:
87+
- name: 'name'
88+
type: String
89+
description: |
90+
Output only. The resource name of the policy.
91+
Format: `organizations/{organization}/consumerPolicies/default`
92+
min_version: 'beta'
93+
output: true
94+
- name: 'etag'
95+
type: String
96+
description: |
97+
An opaque tag indicating the current version of the policy, used for concurrency control.
98+
min_version: 'beta'
99+
output: true
100+
- name: 'createTime'
101+
type: Time
102+
description: |
103+
Output only. The time the policy was created.
104+
min_version: 'beta'
105+
output: true
106+
- name: 'updateTime'
107+
type: Time
108+
description: |
109+
Output only. The time the policy was last updated.
110+
min_version: 'beta'
111+
output: true
112+
- name: 'enableRules'
113+
type: Array
114+
description: |
115+
Enable rules define usable services and service groups.
116+
min_version: 'beta'
117+
item_type:
118+
type: NestedObject
119+
properties:
120+
- name: 'services'
121+
type: Array
122+
description: |
123+
The names of the services that are enabled.
124+
Example: `services/storage.googleapis.com`
125+
min_version: 'beta'
126+
item_type:
127+
type: String
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2026 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: 'ServiceUsageV2'
16+
display_name: 'Service Usage v2'
17+
versions:
18+
- name: 'beta'
19+
base_url: 'https://serviceusage.googleapis.com/v2beta/'
20+
scopes:
21+
- 'https://www.googleapis.com/auth/cloud-platform'
22+
- 'https://www.googleapis.com/auth/service.management'

0 commit comments

Comments
 (0)