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

Fastly plugin crashes when backend variables change #884

Open
sethyates opened this issue Sep 26, 2024 · 0 comments
Open

Fastly plugin crashes when backend variables change #884

sethyates opened this issue Sep 26, 2024 · 0 comments

Comments

@sethyates
Copy link

Terraform Version

Terraform v1.9.6
on linux_amd64
+ provider registry.terraform.io/carlpett/sops v1.1.1
+ provider registry.terraform.io/fastly/fastly v5.13.0
+ provider registry.terraform.io/hashicorp/archive v2.6.0
+ provider registry.terraform.io/hashicorp/google v5.43.1
+ provider registry.terraform.io/hashicorp/google-beta v5.44.0
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3
+ provider registry.terraform.io/pagerduty/pagerduty v3.15.6

Affected Fastly Terraform Resource(s)

  • fastly_service_vcl

Terraform Configuration Files

module "app" {
  source = "../../../modules/cdn_run_backend"

  name       = google_cloud_run_v2_service.tokens.name
  project_id = module.integration.project.project_id
  region     = local.region
  prefix     = "oauth"

  depends_on = [google_cloud_run_v2_service.tokens]
}

resource "fastly_service_vcl" "integration" {
  name               = local.connect_domain
  default_ttl        = 3600
  http3              = true
  stale_if_error     = false
  stale_if_error_ttl = 43200

  domain {
    name = local.connect_domain
  }

  dynamic "backend" {
    for_each = [module.app]   # <- have to remove the module.app when the provider crashes

    content {
      name                  = backend.value.name
      address               = backend.value.address
      override_host         = backend.value.override_host
      between_bytes_timeout = backend.value.between_bytes_timeout
      connect_timeout       = backend.value.connect_timeout
      first_byte_timeout    = backend.value.first_byte_timeout
      max_conn              = backend.value.max_conn
      port                  = backend.value.port
      use_ssl               = backend.value.use_ssl
      ssl_check_cert        = backend.value.ssl_check_cert
      ssl_cert_hostname     = backend.value.ssl_cert_hostname
      ssl_sni_hostname      = backend.value.ssl_sni_hostname
      min_tls_version       = backend.value.min_tls_version
      shield                = backend.value.shield
      request_condition     = backend.value.request_condition
    }
  }

  # more irrelevant stuff
}

Expected Behavior

What should have happened?

The plan should be planned or the apply should be applied.

Actual Behavior

What actually happened?

Any change whatsoever to the underlying Cloud Run service causes the Fastly provider to crash. I have to set for_each = [] to get the configuration to apply, then quickly revert and apply. This obviously causes outages because the backend goes away.

╷
│ Error: Request cancelled
│ 
│   with fastly_service_vcl.integration,
│   on cdn.tf line 12, in resource "fastly_service_vcl" "integration":
│   12: resource "fastly_service_vcl" "integration" {
│ 
│ The plugin.(*GRPCProvider).PlanResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-fastly_v5.13.0 plugin:

panic: value is unknown

goroutine 134 [running]:
github.com/hashicorp/go-cty/cty.Value.AsString({{{0xfc4158?, 0xc00026a27b?}}, {0xd48b80?, 0x1598d60?}})
        github.com/hashicorp/[email protected]/cty/value_ops.go:1179 +0x111
github.com/fastly/terraform-provider-fastly/fastly.validateUniqueNames.func1({0xfc3a90?, 0xc000297890?}, 0x0?, {0xce7ea0?, 0xc00011a9b0?})
        github.com/fastly/terraform-provider-fastly/fastly/base_fastly_service.go:178 +0x171
github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff.All.func1({0xfc3a90, 0xc000297890}, 0xe7e3df?, {0xce7ea0, 0xc00011a9b0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/customdiff/compose.go:52 +0xe6
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0003d84b0, {0xfc3a90, 0xc000297890}, 0xc000317040, 0xc00071cd70, 0xc000306e00, {0xce7ea0, 0xc00011a9b0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:698 +0x4d4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xfc4238?, {0xfc3a90?, 0xc000297890?}, 0xc000317040, 0xd5b740?, {0xce7ea0?, 0xc00011a9b0?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:990 +0xe5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc0003a26f0, {0xfc3a90?, 0xc000297770?}, 0xc000431c20)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:858 +0xc52
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc000263720, {0xfc3a90?, 0xc000296cf0?}, 0xc0000a3900)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:825 +0x3fc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xe45d40?, 0xc000263720}, {0xfc3a90, 0xc000296cf0}, 0xc0000a3880, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000151800, {0xfc3a90, 0xc000296c60}, {0xfc8738, 0xc000002180}, 0xc0002fcfc0, 0xc0004a2210, 0x155a8c0, 0x0)
        google.golang.org/[email protected]/server.go:1369 +0xe69
google.golang.org/grpc.(*Server).handleStream(0xc000151800, {0xfc8738, 0xc000002180}, 0xc0002fcfc0)
        google.golang.org/[email protected]/server.go:1780 +0x106f
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1019 +0x91
created by google.golang.org/grpc.(*Server).serveStreams.func2
        google.golang.org/[email protected]/server.go:1030 +0x145

Error: The terraform-provider-fastly_v5.13.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Debug Output (optional)

Please provide a link to a GitHub Gist containing the complete debug output (see Terraform docs). Ensure any sensitive data is <REDACTED>.

https://gist.github.com/sethyates/a9fee5fb5bc85f3e739732437be6814e

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids (optional)

Is there anything atypical about your account or set up that we should know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant