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

Panic in synthetic test variable handling #1958

Closed
ZsoltPath opened this issue Jun 8, 2023 · 0 comments · Fixed by #1959
Closed

Panic in synthetic test variable handling #1958

ZsoltPath opened this issue Jun 8, 2023 · 0 comments · Fixed by #1959
Labels

Comments

@ZsoltPath
Copy link

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v1.4.6
on darwin_arm64
+ provider registry.terraform.io/datadog/datadog v3.26.0
+ provider registry.terraform.io/hashicorp/archive v2.4.0
+ provider registry.terraform.io/hashicorp/aws v5.1.0
+ provider registry.terraform.io/hashicorp/azuread v2.39.0
+ provider registry.terraform.io/hashicorp/azurerm v3.59.0
+ provider registry.terraform.io/hashicorp/external v2.3.1
+ provider registry.terraform.io/hashicorp/local v2.4.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/tls v4.0.4
+ provider registry.terraform.io/mongodb/mongodbatlas v1.9.0

Affected Resource(s)

Please list the resources as a list, for example:

  • datadog_synthetics_test.frontend

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "datadog_synthetics_test" "frontend" {
  type  = "browser"
  device_ids = [
    "laptop_large",
  ]

  locations = [
    "aws:eu-west-2",
  ]

  name    = module.auth.site_domain_name["natwestmentor"][0]
  status  = "live"
  message = var.environment == "prod" ? "@slack-datadog-alerts" : "@slack-stable-datadog-alerts"

  options_list {

    tick_every       = 600
    monitor_priority = var.environment == "prod" ? 2 : 4

    monitor_options {
      renotify_interval = 0
    }

    retry {
      count    = 1
      interval = 60
    }
  }

  request_definition {
    method = "GET"
    url    = "https://${module.auth.site_domain_name["natwestmentor"][0]}"
  }

  browser_variable {
    id   = data.datadog_synthetics_global_variable.mentor_password.id
    name = data.datadog_synthetics_global_variable.mentor_password.name
    type = "global"
  }

  browser_variable {
    id   = data.datadog_synthetics_global_variable.mentor_username.id
    name = data.datadog_synthetics_global_variable.mentor_username.name
    type = "global"
  }

  lifecycle {
    # Browser steps are hard/impossible to code, better to leave out
    ignore_changes = [browser_step]
  }

  tags = ["env:${var.environment}"]
}

Panic Output

Stack trace from the terraform-provider-datadog_v3.26.0 plugin:

panic: interface conversion: interface {} is nil, not bool

goroutine 122 [running]:
github.com/terraform-providers/terraform-provider-datadog/datadog.updateSyntheticsBrowserTestLocalState(0x101572660?, 0x14000dbca88)
        github.com/terraform-providers/terraform-provider-datadog/datadog/resource_datadog_synthetics_test_.go:2787 +0x29d0
github.com/terraform-providers/terraform-provider-datadog/datadog.resourceDatadogSyntheticsTestRead({0x10160be60?, 0x1400086b710?}, 0x14000955c00, {0x101247e40?, 0x14000af22a0?})
        github.com/terraform-providers/terraform-provider-datadog/datadog/resource_datadog_synthetics_test_.go:1301 +0x748
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x140003b8ee0, {0x10160be60, 0x1400086b710}, 0xd?, {0x101247e40, 0x14000af22a0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:724 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x140003b8ee0, {0x10160be60, 0x1400086b710}, 0x140000ce5b0, {0x101247e40, 0x14000af22a0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1015 +0x468
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x1400000db18, {0x10160be60?, 0x1400086b320?}, 0x140007dac80)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:613 +0x400
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ReadResource({0x14000716540, 0x140007165a0, {0x14000960980, 0x2, 0x2}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
        github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ReadResource.go:26 +0xdc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x1400025d360, {0x10160be60?, 0x1400085c750?}, 0x1400056cd20)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:748 +0x3e8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x101540620?, 0x1400025d360}, {0x10160be60, 0x1400085c750}, 0x14000c1d490, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140009241e0, {0x101610f40, 0x14000518680}, 0x14000b4a240, 0x140009abb60, 0x1022038b0, 0x0)
        google.golang.org/[email protected]/server.go:1340 +0xb7c
google.golang.org/grpc.(*Server).handleStream(0x140009241e0, {0x101610f40, 0x14000518680}, 0x14000b4a240, 0x0)
        google.golang.org/[email protected]/server.go:1713 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:965 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:963 +0x290

Expected Behavior

Nothing need to be changed.

Actual Behavior

Crash

Steps to Reproduce

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

  1. terraform apply
therve added a commit that referenced this issue Jun 9, 2023
… variables

If the example is not set on a test config variable, it gets the secure
field unconditionally and it can crash. This fixes it by checking the
boolean cast properly.

Fixes #1958
@therve therve added the bug label Jun 9, 2023
therve added a commit that referenced this issue Jun 12, 2023
… variables (#1959)

If the example is not set on a test config variable, it gets the secure
field unconditionally and it can crash. This fixes it by checking the
boolean cast properly.

Fixes #1958
@therve therve changed the title terraform-provider-datadog_v3.26.0 plugin crashed! Panic in synthetic test variable handling Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants