Skip to content

Commit

Permalink
Make google_monitoring_metric_descriptor.labels ForceNew
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn committed Sep 21, 2023
1 parent 4a03c32 commit a7e52ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions mmv1/products/monitoring/MetricDescriptor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ properties:
The set of labels that can be used to describe a specific instance of this
metric type. In order to delete a label, the entire resource must be
deleted, then created with the desired labels.
immutable: true
is_set: true
item_type: !ruby/object:Api::Type::NestedObject
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
)

func TestAccMonitoringMetricDescriptor_update(t *testing.T) {
// TODO: Fix requires a breaking change https://github.com/hashicorp/terraform-provider-google/issues/12139
t.Skip()

t.Parallel()
acctest.VcrTest(t, resource.TestCase{
Expand All @@ -19,8 +17,7 @@ func TestAccMonitoringMetricDescriptor_update(t *testing.T) {
CheckDestroy: testAccCheckMonitoringMetricDescriptorDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccMonitoringMetricDescriptor_update("key1", "STRING",
"description1", "30s", "30s"),
Config: testAccMonitoringMetricDescriptor_update("30s", "30s"),
},
{
ResourceName: "google_monitoring_metric_descriptor.basic",
Expand All @@ -29,8 +26,7 @@ func TestAccMonitoringMetricDescriptor_update(t *testing.T) {
ImportStateVerifyIgnore: []string{"metadata", "launch_stage"},
},
{
Config: testAccMonitoringMetricDescriptor_update("key2", "INT64",
"description2", "60s", "60s"),
Config: testAccMonitoringMetricDescriptor_update("60s", "60s"),
},
{
ResourceName: "google_monitoring_metric_descriptor.basic",
Expand All @@ -42,8 +38,7 @@ func TestAccMonitoringMetricDescriptor_update(t *testing.T) {
})
}

func testAccMonitoringMetricDescriptor_update(key, valueType, description,
samplePeriod, ingestDelay string) string {
func testAccMonitoringMetricDescriptor_update(samplePeriod, ingestDelay string) string {
return fmt.Sprintf(`
resource "google_monitoring_metric_descriptor" "basic" {
description = "Daily sales records from all branch stores."
Expand All @@ -53,16 +48,16 @@ resource "google_monitoring_metric_descriptor" "basic" {
value_type = "DOUBLE"
unit = "{USD}"
labels {
key = "%s"
value_type = "%s"
description = "%s"
key = "key"
value_type = "STRING"
description = "description"
}
launch_stage = "BETA"
metadata {
sample_period = "%s"
ingest_delay = "%s"
}
}
`, key, valueType, description, samplePeriod, ingestDelay,
`, samplePeriod, ingestDelay,
)
}

0 comments on commit a7e52ef

Please sign in to comment.