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

Error creating ManagedZone due to timeout #5008

Closed
jnahelou opened this issue Nov 27, 2019 · 3 comments · Fixed by GoogleCloudPlatform/magic-modules#2761
Closed

Error creating ManagedZone due to timeout #5008

jnahelou opened this issue Nov 27, 2019 · 3 comments · Fixed by GoogleCloudPlatform/magic-modules#2761
Assignees
Labels
bug forward/review In review; remove label to forward service/cloud-dns

Comments

@jnahelou
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.

Hi,

Sometime private DNS zone creation fail with the error :

Error: Error creating ManagedZone: googleapi: Error 409: The resource 'entity.managedZone' named 'XXXXX' already exists, alreadyExists

After debugging, I found the error is due to timeout during the POST request (sendRequestWithTimeout(config, "POST", project, url, obj, d.Timeout(schema.TimeoutCreate)) ) which force Terraform to retry the operation :

2019-11-27T16:48:22.584+0100 [DEBUG] plugin.terraform-provider-google-beta_v2.17.0_x4: 2019/11/27 16:48:22 [DEBUG] Dismissed an error as retryable based on googleapis.com target: Post https://www.googleapis.com/dns/v1beta2/projects/YYYYY/managedZones?alt=json: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
2019-11-27T16:48:22.584+0100 [DEBUG] plugin.terraform-provider-google-beta_v2.17.0_x4: 2019/11/27 16:48:22 [TRACE] Waiting 500ms before next try

From

func isRetryableError(err error, retryPredicates []func(e error) (bool, string)) bool {

        // These operations are always hitting googleapis.com - they should rarely
        // time out, and if they do, that timeout is retryable.
        if urlerr, ok := err.(*url.Error); ok && urlerr.Timeout() {
                log.Printf("[DEBUG] Dismissed an error as retryable based on googleapis.com target: %s", err)
                return true
        }

My actual workaround is to run twice the tf apply...

Is-it possible to add an attribute in the provider to increase the http client timeout in google-beta/config.go waiting for an asynchrone creation model ?

        // Each individual request should return within 30s - timeouts will be retried.
        // This is a timeout for, e.g. a single GET request of an operation - not a
        // timeout for the maximum amount of time a logical request can take.
        client.Timeout, _ = time.ParseDuration("30s")

Terraform Version

Terraform v0.12.10
terraform-provider-google-beta_v2.17.0

Affected Resource(s)

  • google_dns_managed_zone

Terraform Configuration Files

provider "google-beta" {
  project = "YYYYYY"
  version = "2.17.0"
}

variable "private_dns_zones" {
  type        = list(string)
  description = "List of all private domains"
  default     = ["sub1.mydomain.com", "sub2.mydomain.com", "sub3.mydomain.com", "sub4.mydomain.com", "sub5.mydomain.com", "sub6.mydomain.com", "sub7.mydomain.com"]
}


resource "google_dns_managed_zone" "priv_sub_domain" {
  provider    = google-beta
  count       = length(var.private_dns_zones)
  name        = replace(var.private_dns_zones[count.index], ".", "-")
  dns_name    = "${var.private_dns_zones[count.index]}."
  description = "Managed by terraform"

  visibility = "private"

  peering_config {
    target_network {
      network_url = "https://www.googleapis.com/compute/v1/projects/XXXX/global/networks/XXXX"
    }
  }
}

Steps to Reproduce

Run this sample multiple time

Link to https://github.com/GoogleCloudPlatform/magic-modules/issues/2756

@ghost ghost added the bug label Nov 27, 2019
@nat-henderson
Copy link
Contributor

That is surprising. I did not know that there were GCP APIs that had synchronous, long-running operations with side-effects. :)

I'll see if there's something I can do that won't alter the behavior of other resources.

@nat-henderson
Copy link
Contributor

Thanks for the in-depth bug report, that was very helpful.

@ghost
Copy link

ghost commented Mar 28, 2020

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 and limited conversation to collaborators Mar 28, 2020
@github-actions github-actions bot added forward/review In review; remove label to forward service/cloud-dns labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/cloud-dns
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants