Skip to content

Retry Calls on HTTP 5XX Response Status Codes #210

@bflad

Description

@bflad

Terraform Version

Terraform v0.11.13
+ provider.github v1.3.0

Affected Resource(s)

In our use case, mainly:

  • github_issue_label

Terraform Configuration Files

# Terraform module used across dozens of repositories

resource "github_issue_label" "breaking-change" {
  repository = "${github_repository.provider.name}"
  name       = "breaking-change"
  color      = "d93f0b"
}

resource "github_issue_label" "bug" {
  repository = "${github_repository.provider.name}"
  name       = "bug"
  color      = "f7c6c7"
}

resource "github_issue_label" "crash" {
  repository = "${github_repository.provider.name}"
  name       = "crash"
  color      = "e11d21"
}

resource "github_issue_label" "documentation" {
  repository = "${github_repository.provider.name}"
  name       = "documentation"
  color      = "fef2c0"
}

resource "github_issue_label" "dependencies" {
  repository = "${github_repository.provider.name}"
  name       = "dependencies"
  color      = "fad8c7"
}

resource "github_issue_label" "enhancement" {
  repository = "${github_repository.provider.name}"
  name       = "enhancement"
  color      = "d4c5f9"
}

resource "github_issue_label" "good_first_issue" {
  repository = "${github_repository.provider.name}"
  name       = "good first issue"
  color      = "128A0C"
}

resource "github_issue_label" "hashibot_ignore" {
  repository = "${github_repository.provider.name}"
  name       = "hashibot/ignore"
  color      = "000000"
}

resource "github_issue_label" "help_wanted" {
  repository = "${github_repository.provider.name}"
  name       = "help wanted"
  color      = "128A0C"
}

resource "github_issue_label" "new-data-source" {
  repository = "${github_repository.provider.name}"
  name       = "new-data-source"
  color      = "d4c5f9"
}

resource "github_issue_label" "new-resource" {
  repository = "${github_repository.provider.name}"
  name       = "new-resource"
  color      = "d4c5f9"
}

resource "github_issue_label" "provider" {
  repository = "${github_repository.provider.name}"
  name       = "provider"
  color      = "bfd4f2"
}

resource "github_issue_label" "question" {
  repository = "${github_repository.provider.name}"
  name       = "question"
  color      = "cc317c"
}

resource "github_issue_label" "regression" {
  repository = "${github_repository.provider.name}"
  name       = "regression"
  color      = "e11d21"
}

resource "github_issue_label" "stale" {
  repository = "${github_repository.provider.name}"
  name       = "stale"
  color      = "e11d21"
}

resource "github_issue_label" "technical-debt" {
  repository = "${github_repository.provider.name}"
  name       = "technical-debt"
  color      = "1d76db"
}

resource "github_issue_label" "waiting-response" {
  repository = "${github_repository.provider.name}"
  name       = "waiting-response"
  color      = "5319e7"
}

resource "github_issue_label" "upstream" {
  repository = "${github_repository.provider.name}"
  name       = "upstream"
  color      = "fad8c7"
}

resource "github_issue_label" "upstream-terraform" {
  repository = "${github_repository.provider.name}"
  name       = "upstream-terraform"
  color      = "cccccc"
}

variable "sizes" {
  default = ["XS", "S", "M", "L", "XL", "XXL"]
}

resource "github_issue_label" "size" {
  count      = "${length(var.sizes)}"
  repository = "${github_repository.provider.name}"
  name       = "size/${var.sizes[count.index]}"
  color      = "ffffff"
}

Debug Output

Issue is intermittent, can provide if necessary.

Expected Behavior

The Terraform resource should retry the HTTP request on retryable HTTP response status codes (e.g. 5XX).

Actual Behavior

Error: Error refreshing state: 4 error(s) occurred:

* module.fortios.github_issue_label.stale: 1 error(s) occurred:

* module.fortios.github_issue_label.stale: github_issue_label.stale: GET https://api.github.com/repos/terraform-providers/terraform-provider-fortios/labels/stale: 502 Server Error []
* module.brightbox.github_issue_label.size: 1 error(s) occurred:

* module.brightbox.github_issue_label.size[2]: github_issue_label.size.2: GET https://api.github.com/repos/terraform-providers/terraform-provider-brightbox/labels/size/M: 502 Server Error []
* module.rancher.github_issue_label.question: 1 error(s) occurred:

* module.rancher.github_issue_label.question: github_issue_label.question: GET https://api.github.com/repos/terraform-providers/terraform-provider-rancher/labels/question: 502 Server Error []
* module.tfe.github_issue_label.regression: 1 error(s) occurred:

* module.tfe.github_issue_label.regression: github_issue_label.regression: GET https://api.github.com/repos/terraform-providers/terraform-provider-tfe/labels/regression: 502 Server Error []

Steps to Reproduce

  1. terraform apply

Important Factoids

The Terraform state above has 2600+ github_issue_label resources. (Occurs more often on larger amounts of github_issue_label resources.)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleUsed by stalebot to clean houseStatus: Up for grabsIssues that are ready to be worked on by anyoneType: FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions