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

azurerm_servicebus_subscription_rule correlation_filter with whitespace label causes crash #18891

Closed
1 task done
UptiveJohnA opened this issue Oct 20, 2022 · 5 comments · Fixed by #19352
Closed
1 task done

Comments

@UptiveJohnA
Copy link

UptiveJohnA commented Oct 20, 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.3.2

AzureRM Provider Version

3.0.0

Affected Resource(s)/Data Source(s)

azurerm_servicebus_subscription_rule

Terraform Configuration Files

resource "azurerm_servicebus_subscription_rule" "foobar-subscription-rules" {
  name            = "foobar-subscription-rules"
  subscription_id = azurerm_servicebus_subscription.foobar-subscription.id
  filter_type     = "CorrelationFilter"

  correlation_filter {
    label = ""
  }
}

Debug Output/Panic Output

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

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 219 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus.expandAzureRmServiceBusCorrelationFilter(0x663c7c0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go:382 +0x854
github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus.resourceServiceBusSubscriptionRuleCreateUpdate(0xc00240bf00, {0x567d7c0, 0xc001433880})
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go:286 +0x705
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc002429e60, {0x668d1b8, 0xc002271a80}, 0x2, {0x567d7c0, 0xc001433880})
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:329 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000e376c0, {0x668d1b8, 0xc002271a80}, 0xc00240d2b0, 0xc00240bd80, {0x567d7c0, 0xc001433880})
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:467 +0x871
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0007262b8, {0x668d1b8, 0xc002271a80}, 0xc002259180)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000212580, {0x668d260, 0xc002413410}, 0xc001327030)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go:603 +0x30e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x5bc6ca0, 0xc000212580}, {0x668d260, 0xc002413410}, 0xc002408a80, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001476380, {0x66de168, 0xc000c2f380}, 0xc002276360, 0xc001328390, 0xad51f60, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1292 +0xc6f
google.golang.org/grpc.(*Server).handleStream(0xc001476380, {0x66de168, 0xc000c2f380}, 0xc002276360, 0x0)
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1617 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:940 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:938 +0x294

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

Expected Behaviour

I thought we would provision a filter with a blank white space filter, or if that was forbidden get some kind of warning

Actual Behaviour

The script crashed

Steps to Reproduce

Provision a subscription rule with a whitespace label in the correlation_filter

Important Factoids

No response

References

No response

@Amier3
Copy link
Contributor

Amier3 commented Nov 7, 2022

Hey @UptiveJohnA

Thanks for bringing this to our attention, will look into this!

@mbfrahry
Copy link
Member

Hey @UptiveJohnA, I've been digging into this today and have fixed the crash. Unfortunately, I couldn't see a clean way to just add an empty label to the correlation filter because of the way Terraform views that block.

If Terraform sees a block like:

correlation_filter {
    label = ""
  }

It'll view that whole block as empty so the provider can't tell what attribute in that block needs to be specified as empty. It's a weird edge case and the best I can do is to just return an error that says at least one attribute must not be empty for correlation filters.

@UptiveJohnA
Copy link
Author

UptiveJohnA commented Nov 17, 2022 via email

@github-actions github-actions bot added this to the v3.33.0 milestone Nov 18, 2022
@github-actions
Copy link

This functionality has been released in v3.33.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@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 Dec 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants