hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.53k stars 4.6k forks source link

The specified EventDeliverySchema value \"CustomInputSchema\" cannot be used in combination with the topic's input schema of EventGridSchema. #18563

Open vinayreddyav opened 1 year ago

vinayreddyav commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.0

AzureRM Provider Version

3.10.0

Affected Resource(s)/Data Source(s)

azurerm_eventgrid_event_subscription

Terraform Configuration Files

resource "azurerm_eventgrid_topic" "eventpipeline_eventgrid_topic" {
  name                = "${var.tags.Team}-${var.tags.Name}-${var.tags.Env}-topic-${var.region_short}"
  location            = azurerm_resource_group.eventpipeline_resource_group.location
  resource_group_name = azurerm_resource_group.eventpipeline_resource_group.name
  input_schema        = "CustomEventSchema"
  input_mapping_fields{
    data_version   = "data.dataVersion"
    event_type    = "data.eventType"
    subject       = "data.subject"
  }

  tags = var.tags
}

resource "azurerm_eventgrid_event_subscription" "eventpipeline_eventgrid_topic_subscription_eventhub" {
  name                          = "${var.tags.Team}-${var.tags.Name}-${var.tags.Env}-topic-${var.region_short}-subscription-eventhub"
  advanced_filtering_on_arrays_enabled = true
  scope                         = azurerm_resource_group.eventpipeline_resource_group.id
  eventhub_endpoint_id          = azurerm_eventhub.eventpipeline_eventhub.id
  depends_on                    = [azurerm_eventgrid_topic.eventpipeline_eventgrid_topic]
  event_delivery_schema         = "CustomInputSchema"
}

Debug Output/Panic Output

Error: creating/updating Event Subscription: "): eventgrid.EventSubscriptionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidRequest" Message="The specified EventDeliverySchema value \"CustomInputSchema\" cannot be used in combination with the topic's input schema of EventGridSchema."
│ 
│   with module.eventpipeline.azurerm_eventgrid_event_subscription.eventpipeline_eventgrid_topic_subscription_eventhub,
│   on ../../modules/eventpipeline/eventgrid_resources.tf line 16, in resource "azurerm_eventgrid_event_subscription" "eventpipeline_eventgrid_topic_subscription_eventhub":
│   16: resource "azurerm_eventgrid_event_subscription" "eventpipeline_eventgrid_topic_subscription_eventhub" {

Expected Behaviour

this scenario works when creating from azure portal

Actual Behaviour

Error - The specified EventDeliverySchema value \"CustomInputSchema\" cannot be used in combination with the topic's input schema of EventGridSchema.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

xiaxyi commented 1 year ago

Thanks @vinayreddyav for raising this issue. The resource provider azurerm_eventgrid_event_subscription is to create the event grid event subscription not the subscription under topics.