diff --git a/mmv1/products/logging/Metric.yaml b/mmv1/products/logging/Metric.yaml index 1ba2e4ce4979..d83c0aaa3b21 100644 --- a/mmv1/products/logging/Metric.yaml +++ b/mmv1/products/logging/Metric.yaml @@ -11,7 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- !ruby/object:Api::Resource +--- +!ruby/object:Api::Resource name: "Metric" base_url: projects/{{project}}/metrics # The % in self_link indicates that the name value should be URL-encoded. @@ -51,6 +52,11 @@ examples: logging_metric_name: "my-(custom)/metric" test_env_vars: project: :PROJECT_NAME + - !ruby/object:Provider::Terraform::Examples + name: "logging_metric_disabled" + primary_resource_id: "logging_metric" + vars: + logging_metric_name: "my-(custom)/metric" 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 @@ -75,6 +81,10 @@ properties: description: | The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric. + - !ruby/object:Api::Type::Boolean + name: disabled + description: | + If set to True, then this metric is disabled and it does not generate any points. - !ruby/object:Api::Type::String name: filter description: | @@ -155,7 +165,7 @@ properties: required: false default_value: :STRING immutable: true - custom_flatten: 'templates/terraform/custom_flatten/default_if_empty.erb' + custom_flatten: "templates/terraform/custom_flatten/default_if_empty.erb" - !ruby/object:Api::Type::String name: displayName description: | diff --git a/mmv1/templates/terraform/examples/logging_metric_disabled.tf.erb b/mmv1/templates/terraform/examples/logging_metric_disabled.tf.erb new file mode 100644 index 000000000000..9efab7e6d497 --- /dev/null +++ b/mmv1/templates/terraform/examples/logging_metric_disabled.tf.erb @@ -0,0 +1,9 @@ +resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]["logging_metric_name"] %>" + filter = "resource.type=gae_app AND severity>=ERROR" + metric_descriptor { + metric_kind = "DELTA" + value_type = "INT64" + } + disabled = true +}