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

pubsub_subscription retry_policy.minimum_backoff outputs diff with fractional seconds. #9038

Closed
Assignees
Labels

Comments

@toumorokoshi
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

$ terraform -v
Terraform v0.15.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v3.66.1

Affected Resource(s)

Terraform Configuration Files

resource "google_pubsub_topic" "example" {
  name = "example-topic"
}

resource "google_pubsub_subscription" "example" {
  name  = "example-subscription"
  topic = google_pubsub_topic.example.name

  retry_policy {
    minimum_backoff = "60.0s"
  }
}

Debug Output

output.

Panic Output

Expected Behavior

no diff if there is no change in the value of minimum_backoff.

Actual Behavior

Terraform plan shows that the value's retry_policy.minimum_backoff has changed:

  # google_pubsub_subscription.example will be updated in-place
  ~ resource "google_pubsub_subscription" "example" {
        id                         = "projects/cnrm-yusuketsutsumi/subscriptions/example-subscription"
        name                       = "example-subscription"
        # (8 unchanged attributes hidden)


      ~ retry_policy {
          ~ minimum_backoff = "60s" -> "60.0s"
            # (1 unchanged attribute hidden)
        }
        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. terraform apply
  2. terraform plan

This only occurs with fractional seconds: whole seconds seems to work fine.

Important Factoids

References

@edwardmedia edwardmedia self-assigned this Apr 30, 2021
@edwardmedia
Copy link
Contributor

@toumorokoshi this seems to be an api issue. The provider sends right format "60.0s" which is good as specified by api doc but receives "60s".

PUT /v1/projects/myproject/subscriptions/issue9038?alt=json HTTP/1.1
Host: pubsub.googleapis.com
{
 "deadLetterPolicy": null,
 "expirationPolicy": null,
 "messageRetentionDuration": "604800s",
 "retryPolicy": {
  "minimumBackoff": "60.0s"
 },
 "topic": "projects/myproject/topics/issue9038"
}

---[ RESPONSE ]--------------------------------------
{
  "name": "projects/myproject/subscriptions/issue9038",
  "topic": "projects/myproject/topics/issue9038",
  "pushConfig": {},
  "ackDeadlineSeconds": 10,
  "messageRetentionDuration": "604800s",
  "expirationPolicy": {
    "ttl": "2678400s"
  },
  "retryPolicy": {
    "minimumBackoff": "60s",
    "maximumBackoff": "600s"
  }
}

@rileykarson
Copy link
Collaborator

Ah this is one of the "duration format" fields, they're problematic. They'll theoretically accept a high precision interval and the documentation states as much, but most APIs will just round whatever the user provides to seconds anyways. Do we know if fractional values like "12.5s" are even accepted here? They aren't most of the time, and only whole seconds are.

I don't think we've added special handling for these kinds of fields in the past, although we may have tightened the description in Terraform. You can find a bunch of them by searching the string A duration in seconds with up to nine fractional digits, terminated by 's'. within the provider.

This would theoretically get fixed by #4328 and we probably don't need to take action outside of (eventually) doing that because users can just specify a whole number of seconds.

@edwardmedia
Copy link
Contributor

I am building a diffSupress func now

@ghost
Copy link

ghost commented May 31, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.