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

Plugin crash if cookies_condition is used on azurerm_cdn_frontdoor_rule #18370

Closed
1 task done
ghost opened this issue Sep 13, 2022 · 3 comments · Fixed by #18231
Closed
1 task done

Plugin crash if cookies_condition is used on azurerm_cdn_frontdoor_rule #18370

ghost opened this issue Sep 13, 2022 · 3 comments · Fixed by #18231

Comments

@ghost
Copy link

ghost commented Sep 13, 2022

Is there an existing issue for this?

  • I have searched the existing issues

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

Terraform Version

1.1.7

AzureRM Provider Version

3.22.0

Affected Resource(s)/Data Source(s)

azurerm_cdn_frontdoor_rule

Terraform Configuration Files

terraform {
  required_version = ">= 1.1.7"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.22.0"
    }
  }
}

resource "azurerm_cdn_frontdoor_rule_set" "rs" {
  name                     = "test"
  cdn_frontdoor_profile_id = var.frontdoor_id
}

resource "azurerm_cdn_frontdoor_rule" "rule" {
  name                      = "rule"
  cdn_frontdoor_rule_set_id = azurerm_cdn_frontdoor_rule_set.rs.id
  order                     = 1
  behavior_on_match         = "Stop"

  conditions {
    cookies_condition {
      cookie_name  = "some_cookie"
      operator     = "Equal"
      transforms   = ["Lowercase"]
      match_values = ["some value"]
    }
  }

  actions {
    url_redirect_action {
      redirect_type        = "Found"
      destination_hostname = var.custom_hostname
      redirect_protocol    = "MatchRequest"
      destination_path     = "/test"
    }
  }
}

Debug Output/Panic Output

╷
│ Error: Plugin did not respond
│
│   with module.website.azurerm_cdn_frontdoor_rule.rule,
│   on ..\..\modules\website\main.tf line 83, in resource "azurerm_cdn_frontdoor_rule" "rule":
│   83: resource "azurerm_cdn_frontdoor_rule" "rule" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The
│ plugin logs may contain more details.
╵

Stack trace from the terraform-provider-azurerm_v3.22.0_x5.exe plugin:

panic: interface conversion: interface {} is *schema.Set, not []interface {}

goroutine 101 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleconditions.ExpandCdnFrontDoorCookiesCondition({0xc001702da0, 0x1, 0x6aba192?})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go:812 +0x785
github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn.expandFrontdoorDeliveryRuleConditions({0xc001702d70, 0x1, 0x722ba40?})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_rule_resource.go:884 +0x7d2
github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn.resourceCdnFrontDoorRuleCreate(0x0?, {0x60e1740?, 0xc0001ea380})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_rule_resource.go:637 +0x65c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x72357c8?, {0x72357c8?, 0xc001898cc0?}, 0xd?, {0x60e1740?, 0xc0001ea380?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:695 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000a74c40, {0x72357c8, 0xc001898cc0}, 0xc001a8e750, 0xc001897f00, {0x60e1740, 0xc0001ea380})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0xa7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0005290e0, {0x72357c8?, 0xc001898c00?}, 0xc001a83ef0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xe3c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0004bf180, {0x72357c8?, 0xc0018984b0?}, 0xc0008d78f0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:813 +0x4fc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x66d0680?, 0xc0004bf180}, {0x72357c8, 0xc0018984b0}, 0xc00195a240, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000236c40, {0x72470d8, 0xc00122c4e0}, 0xc00182b440, 0xc00128a5a0, 0xb2fcfc0, 0x0)
        google.golang.org/[email protected]/server.go:1283 +0xcfd
google.golang.org/grpc.(*Server).handleStream(0xc000236c40, {0x72470d8, 0xc00122c4e0}, 0xc00182b440, 0x0)
        google.golang.org/[email protected]/server.go:1620 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:922 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:920 +0x28a

Error: The terraform-provider-azurerm_v3.22.0_x5.exe plugin crashed!

Expected Behaviour

No response

Actual Behaviour

An empty rule set is created. The rule with a cookies_condition is missing / not created.
If cookies_condition is replaced with a request_header_condition the rule is created successfully.

Steps to Reproduce

No response

Important Factoids

'azurerm' backend is used for state management.

References

No response

@ghost ghost added the bug label Sep 13, 2022
@github-actions github-actions bot added the crash label Sep 13, 2022
@Amier3
Copy link
Contributor

Amier3 commented Sep 13, 2022

@comspace-lfr

Thanks for bringing this to our attention. I was able to replicate the crash so we'll investigate this and figure out what's going on here 👁️

@WodansSon
Copy link
Collaborator

@comspace-lfr Thanks for reporting this issue and @Amier3 for bringing it to my attention 🙂 I have checked in this commit that will fix this issue.

WodansSon added a commit that referenced this issue Sep 29, 2022
…18551

* initial check-in

* still refactoring but should be functional

* Doc updates

* deprecate health_probes_enabled property

* Update website/docs/r/cdn_frontdoor_custom_domain_secret_validator.html.markdown

Co-authored-by: Sebastian <[email protected]>

* Update website/docs/r/cdn_frontdoor_custom_domain_txt_validator.html.markdown

Co-authored-by: Sebastian <[email protected]>

* refactor CIDR validation into validation packages

* fix naked return lint error in cidr overlap func

* Update code comments to add context

* Fix for 18249

* Remove txt and secret validators

* Remove validator ids, parse/validation packages

* Update rules doc for depends_on usage

* Doc updates

* Update test cases

* Correct skip txt for origin test

* More test and doc updates

* Update test and docs to use new subnet field

* Fix for 18370

* Update docs per PR comment

* Incremental fixed per PR review

* Initial additon of association and doc fix

* Custom domain assoc mostly working

* Additional progress...

* Fix lint errors

* Fix lint errors

* Last of the PR comments addressed...

* Fix for issue #18551

* Mostly working not done with the disable resource

* Done

Co-authored-by: Sebastian <[email protected]>
@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.