terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

Failing test(s): TestAccMonitoringMetricDescriptor_update (permadiff)

Open melinath opened this issue 3 years ago • 4 comments

Failure rate: 100% since 7/15/2022

Impacted tests:

  • TestAccMonitoringMetricDescriptor_update

Nightly builds:

  • https://ci-oss.hashicorp.engineering/buildConfiguration/GoogleCloud_ProviderGoogleCloudGoogleProject/315760?buildTab=tests&expandedTest=-1336336578166089859

Message:

# google_monitoring_metric_descriptor.basic will be updated in-place
~ resource "google_monitoring_metric_descriptor" "basic" {
id                       = "projects/project-id/metricDescriptors/custom.googleapis.com/stores/daily_sales"
name                     = "projects/project-id/metricDescriptors/custom.googleapis.com/stores/daily_sales"
# (9 unchanged attributes hidden)
- labels {
- description = "description1" -> null
- key         = "key1" -> null
- value_type  = "STRING" -> null
}

melinath avatar Jul 20 '22 21:07 melinath

This is a real permadiff but it's not a breaking change since the labels field isn't ForceNew. I don't see any changes in the provider that would've caused this so it's probably an api-side change.

Specifically, it looks like the API is not properly updating the labels to remove the old label:

---[ REQUEST ]---------------------------------------
POST /v3/projects/project-id/metricDescriptors?alt=json HTTP/1.1
Host: monitoring.googleapis.com
User-Agent: Terraform/1.2.5 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google/dev
Content-Length: 347
Content-Type: application/json
Accept-Encoding: gzip

{
 "description": "Daily sales records from all branch stores.",
 "displayName": "daily sales",
 "labels": [
  {
   "description": "description2",
   "key": "key2",
   "valueType": "INT64"
  }
 ],
 "launchStage": "BETA",
 "metadata": {
  "ingestDelay": "60s",
  "samplePeriod": "60s"
 },
 "metricKind": "GAUGE",
 "type": "custom.googleapis.com/stores/daily_sales",
 "unit": "{USD}",
 "valueType": "DOUBLE"
}

-----------------------------------------------------
2022/07/20 14:15:11 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Wed, 20 Jul 2022 14:15:11 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
  "name": "projects/project-id/metricDescriptors/custom.googleapis.com/stores/daily_sales",
  "labels": [
    {
      "key": "key2",
      "valueType": "INT64",
      "description": "description2"
    },
    {
      "key": "key1",
      "description": "description1"
    }
  ],
  "metricKind": "GAUGE",
  "valueType": "DOUBLE",
  "unit": "{USD}",
  "description": "Daily sales records from all branch stores.",
  "displayName": "daily sales",
  "type": "custom.googleapis.com/stores/daily_sales",
  "metadata": {
    "samplePeriod": "60s",
    "ingestDelay": "60s"
  },
  "launchStage": "BETA"
}

melinath avatar Jul 22 '22 17:07 melinath

Oddly, this api doesn't actually seem to officially support updates at all - only create & delete. So it's odd that we're a) allowing update, and b) treating the update as an update https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors/create

melinath avatar Jul 22 '22 17:07 melinath

b/239950166

melinath avatar Jul 22 '22 17:07 melinath

b/239950421

melinath avatar Jul 25 '22 20:07 melinath

AarshDhokai avatar Dec 02 '22 12:12 AarshDhokai

b/261813022

AarshDhokai avatar Dec 08 '22 07:12 AarshDhokai

The permadiff for this test has gotten longer.

melinath avatar Dec 16 '22 22:12 melinath

The change here is that the labels field should either be ForceNew or output-only - see b/ tickets for more details.

melinath avatar Aug 07 '23 18:08 melinath

closed with https://github.com/GoogleCloudPlatform/magic-modules/pull/8914

c2thorn avatar Sep 26 '23 15:09 c2thorn

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Oct 27 '23 02:10 github-actions[bot]