Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_pubsub_lite_topic field modification sends wrong topic name to server. #29040

Closed
ns-jhu opened this issue Jun 25, 2021 · 3 comments
Closed
Labels
bug new new issue not yet triaged

Comments

@ns-jhu
Copy link

ns-jhu commented Jun 25, 2021

Terraform Version

0.14.8 and 1.0.1
...

Terraform Configuration Files

data "google_project" "project" {
}

resource "google_pubsub_lite_topic" "dp_messages" {
  name    = "dp_messages"
  project = data.google_project.project.number
  zone    = var.zone

  partition_config {
    count = 1
    capacity {
      publish_mib_per_sec   = 4
      subscribe_mib_per_sec = 8
    }
  }



}

...

use the above to create a pubsublite topics, it works fine. then change the count to 2 and apply, to modify the partitions.
then it reports

Request has an invalid topic name: {name}}

Debug Output

module.pubsublite.google_pubsub_lite_topic.dp_messages: Modifying... [id=projects/1022764673786/locations/us-west1-c/topics/dp_messages]
2021/06/25 10:22:01 [DEBUG] EvalApply: ProviderMeta config value set
2021/06/25 10:22:01 [DEBUG] module.pubsublite.google_pubsub_lite_topic.dp_messages: applying the planned Update change
2021-06-25T10:22:01.468-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Updating Topic "projects/1022764673786/locations/us-west1-c/topics/dp_messages": map[string]interface {}{"partitionConfig":map[string]interface {}{"capacity":map[string]interface {}{"publishMibPerSec":4, "subscribeMibPerSec":8}, "count":6}, "retentionConfig":map[string]interface {}{"perPartitionBytes":"32212254720", "period":"604800s"}}: timestamp=2021-06-25T10:22:01.468-0700
2021-06-25T10:22:01.468-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Waiting for state to become: [success]: timestamp=2021-06-25T10:22:01.468-0700
2021-06-25T10:22:01.468-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2021-06-25T10:22:01.468-0700
2021-06-25T10:22:01.468-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Retry Transport: request attempt 0: timestamp=2021-06-25T10:22:01.468-0700
2021-06-25T10:22:01.468-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
PATCH /v1/admin/projects/1022764673786/locations/us-west1-c/topics/%7Bname%7D%7D?alt=json&updateMask=partitionConfig HTTP/1.1
Host: us-west1-pubsublite.googleapis.com
User-Agent: Terraform/0.14.8 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.73.0
Content-Length: 162
Content-Type: application/json
Accept-Encoding: gzip

{
"partitionConfig": {
"capacity": {
"publishMibPerSec": 4,
"subscribeMibPerSec": 8
},
"count": 6
},
"retentionConfig": {
"perPartitionBytes": "32212254720",
"period": "604800s"
}
}

-----------------------------------------------------: timestamp=2021-06-25T10:22:01.468-0700
2021-06-25T10:22:01.685-0700 [INFO] plugin.terraform-provider-google_v3.73.0_x5: 2021/06/25 10:22:01 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 400 Bad Request
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":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: Fri, 25 Jun 2021 17:22:01 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"error": {
"code": 400,
"message": "Request has an invalid topic name: {name}}",
"status": "INVALID_ARGUMENT"
}
}

please note that in the above diagnostics log, the URI posted to GCP is

PATCH /v1/admin/projects/1022764673786/locations/us-west1-c/topics/%7Bname%7D%7D
instead of the correct one.
PATCH /v1/admin/projects/1022764673786/locations/us-west1-c/topics/dp_messages

when we decode %7Bname%7D%7D, it is {name}}, which explains why the GCP server side gives the error message
"Request has an invalid topic name: {name}}",

this is clearly a bug in the terraform code, and it is relatively easy to fix.

Crash Output

Expected Behavior

we expect the partition count changed to 2.

Actual Behavior

partition doesn't change, the "terraform apply" failed with error:

"Request has an invalid topic name: {name}}",

Steps to Reproduce

Additional Context

References

@ns-jhu ns-jhu added bug new new issue not yet triaged labels Jun 25, 2021
@jbardin
Copy link
Member

jbardin commented Jul 6, 2021

This appears to be an issue or question with the Goole provider, not with Terraform itself. You can see existing issues and file a new one in their repository here: https://github.com/hashicorp/terraform-provider-google/issues. If you have questions about Terraform or the Google provider, it's better to use the community forum where there are more people ready to help. The GitHub issues here are monitored only by our few core maintainers.

Thanks!

@jbardin jbardin closed this as completed Jul 6, 2021
@ns-jhu
Copy link
Author

ns-jhu commented Jul 6, 2021

created ticket hashicorp/terraform-provider-google#9511 related to this.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2021

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 github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants