-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Must provide all optional values in azurerm_eventgrid_event_subscription.subject_filter or get a TF crash #7144
Comments
This is a bug inside the expand function for the subject filter. Although the schema params are defined as Optional they are required as otherwise the type conversion fails due to a nil pointer dereference. |
Thanks for opening this issue. After tested, seems I can create this resource successfully with below tfconfig which is similar with yours. Perhaps this issue only occurred in some cases. If you want, please have a try below tfconfig to check whether the problem still exists. If still exists, could you possibly share entire tf config that trigger this problem? Thanks.
|
Here's the whole module I'm using. I can't easily provide the entire config, since it's one part of a big infrastructure. It may also be due to using default values ("") for subject_begins_with, subject_ends_with. function-event-grid-subscription.zip Hope that helps. |
@kirk-marple , sorry, seems I still cannot repro this issue with your tfconfig after tested. And then I also checked your debug log, seems you encountered this issue at modification stage not first creation, right? If yes, could you provide the repro steps? |
@kirk-marple, I think I can repro it now. Seems the failure is caused by nil pointer reference error while |
This has been released in version 2.14.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.14.0"
}
# ... other configuration ... |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Found a strange issue when creating Azure Event Grid subscription.
If I don't provide all the values of 'subject_filter' block, I get a hard crash (Gist below), and it says it's a Terraform bug.
From looking at the code, it shows all values as optional for subject_filter, so I'm not clear why they're all required.
Community Note
Terraform (and AzureRM Provider) Version
AzureRM: 2.12
Terraform 0.12.26
Affected Resource(s)
resource "azurerm_eventgrid_event_subscription" "event_grid_subscription" {
name = "${var.platform_name}-subscription-${var.function_name}"
scope = var.topic_id
event_delivery_schema = "EventGridSchema"
included_event_types = var.included_event_types
subject_filter {
subject_begins_with = var.subject_begins_with
subject_ends_with = var.subject_ends_with
NOTE: commenting out this line causes this crash
}
webhook_endpoint {
url = "${var.functions_uri}/runtime/webhooks/EventGrid?functionName=${var.function_name}&code=${var.functions_key}"
}
}
Debug Output
https://gist.github.com/kirk-marple/12c844ec9e436f4763c8eff788880bd1
Expected Behavior
Successfully create Azure Event Grid subscription to webhook.
Actual Behavior
Failed to create Azure Event Grid subscription.
Steps to Reproduce
This fails:
subject_filter {
subject_begins_with = var.subject_begins_with
subject_ends_with = var.subject_ends_with
case_sensitive = false
}
This works:
subject_filter {
subject_begins_with = var.subject_begins_with
subject_ends_with = var.subject_ends_with
case_sensitive = false
}
The text was updated successfully, but these errors were encountered: