Skip to content

Commit

Permalink
Move AlertPolicy labels to user_labels and make them a map (#1685)
Browse files Browse the repository at this point in the history
Merged PR #1685.
  • Loading branch information
slevenick authored and modular-magician committed Apr 25, 2019
1 parent f093f18 commit 78694ff
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
2 changes: 1 addition & 1 deletion build/terraform-mapper
12 changes: 8 additions & 4 deletions products/monitoring/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,14 @@ objects:
entries in this field is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`
item_type: Api::Type::String
- !ruby/object:Api::Type::Array
name: 'labels'
description: 'User-supplied key/value data to be used for organizing AlertPolicy objects.'
item_type: Api::Type::String
- !ruby/object:Api::Type::KeyValuePairs
name: userLabels
description: |
This field is intended to be used for organizing and identifying the AlertPolicy
objects.The field can contain up to 64 entries. Each key and value is limited
to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values
can contain only lowercase letters, numerals, underscores, and dashes. Keys
must begin with a letter.
- !ruby/object:Api::Type::NestedObject
name: documentation
description: |
Expand Down
1 change: 1 addition & 0 deletions products/monitoring/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/self_link_as_name.erb
post_create: templates/terraform/post_create/set_computed_name.erb
extra_schema_entry: templates/terraform/extra_schema_entry/alert_policy.erb
Group: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: "{{name}}"
import_format: ["{{name}}"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" {
}
}
}

user_labels = {
foo = "bar"
}
}
22 changes: 22 additions & 0 deletions templates/terraform/extra_schema_entry/alert_policy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%# The license inside this block applies to this file.
# Copyright 2018 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
"labels": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Deprecated: "labels is removed as it was never used. See user_labels for the correct field",
},

0 comments on commit 78694ff

Please sign in to comment.