Skip to content

Commit 11df7d9

Browse files
authored
artifactregistry: add google_artifact_registry_project_config for platform logs (#18020)
Signed-off-by: AvivGuiser <avivguiser@gmail.com>
1 parent 04549cf commit 11df7d9

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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: 'ProjectConfig'
16+
description: |-
17+
The Artifact Registry project config, used to configure platform logs that
18+
apply to a project.
19+
references:
20+
guides:
21+
'Access and use platform logs': 'https://cloud.google.com/artifact-registry/docs/platform-logs'
22+
api: 'https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations/getProjectConfig'
23+
docs:
24+
note: |-
25+
A project config is automatically created for a given location. Creating a
26+
resource of this type will acquire and update the resource that already
27+
exists at the location. Deleting this resource will remove the config from
28+
your Terraform state but leave the resource as is.
29+
id_format: 'projects/{{project}}/locations/{{location}}/projectConfig'
30+
base_url: 'projects/{{project}}/locations/{{location}}/projectConfig'
31+
self_link: 'projects/{{project}}/locations/{{location}}/projectConfig'
32+
import_format:
33+
- 'projects/{{project}}/locations/{{location}}/projectConfig'
34+
create_url: 'projects/{{project}}/locations/{{location}}/projectConfig?updateMask=platformLogsConfig'
35+
create_verb: 'PATCH'
36+
update_url: 'projects/{{project}}/locations/{{location}}/projectConfig?updateMask=platformLogsConfig'
37+
update_verb: 'PATCH'
38+
exclude_delete: true
39+
timeouts:
40+
insert_minutes: 20
41+
update_minutes: 20
42+
delete_minutes: 20
43+
async:
44+
actions: ['']
45+
type: 'OpAsync'
46+
# necessary to compile
47+
operation:
48+
base_url: '{{op_id}}'
49+
result:
50+
resource_inside_response: false
51+
custom_code:
52+
encoder: 'templates/terraform/encoders/location_from_region.go.tmpl'
53+
samples:
54+
- name: 'artifact_registry_project_config'
55+
primary_resource_id: 'my-config'
56+
steps:
57+
# Step 1 -> create test
58+
- name: 'artifact_registry_project_config'
59+
vars:
60+
severity_level: 'INFO'
61+
# Step 2 -> update test (in-place update of severity_level)
62+
- name: 'artifact_registry_project_config'
63+
vars:
64+
severity_level: 'WARNING'
65+
parameters:
66+
- name: 'location'
67+
type: String
68+
description: |
69+
The name of the location this config is located in.
70+
url_param_only: true
71+
required: false
72+
immutable: true
73+
default_from_api: true
74+
- name: 'name'
75+
type: String
76+
description: |-
77+
The name of the project's config.
78+
Always of the form: projects/{project}/locations/{location}/projectConfig
79+
output: true
80+
properties:
81+
- name: 'platformLogsConfig'
82+
type: NestedObject
83+
description: |-
84+
Configuration for platform logs.
85+
properties:
86+
- name: 'loggingState'
87+
type: Enum
88+
description: |-
89+
The state of the platform logs: enabled or disabled.
90+
enum_values:
91+
- 'ENABLED'
92+
- 'DISABLED'
93+
- name: 'severityLevel'
94+
type: Enum
95+
description: |-
96+
The severity level for the logs. Logs will be generated if their
97+
severity level is >= than the value of the severity level mentioned here.
98+
enum_values:
99+
- 'DEBUG'
100+
- 'INFO'
101+
- 'NOTICE'
102+
- 'WARNING'
103+
- 'ERROR'
104+
- 'CRITICAL'
105+
- 'ALERT'
106+
- 'EMERGENCY'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "google_artifact_registry_project_config" "{{$.PrimaryResourceId}}" {
2+
location = "us-central1"
3+
platform_logs_config {
4+
logging_state = "ENABLED"
5+
severity_level = "{{index $.Vars "severity_level"}}"
6+
}
7+
}

0 commit comments

Comments
 (0)