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.59k stars 4.63k forks source link

How to define a azurerm_eventgrid_event_subscription for IoT hub with ServiceBus queue? #9594

Closed hmrc87 closed 3 years ago

hmrc87 commented 3 years ago

Hi, before we were using the following command as a nullressource in order to create the subscription we need

az eventgrid event-subscription create --name $eventGridSubscriptionName --source-resource-id $iotHubResourceId - -endpoint-type servicebusqueue --endpoint $serviceBusQueueId --max-delivery-attempts 10 --event-ttl 120 --included-event-types Microsoft.Devices.DeviceConnected Microsoft.Devices.DeviceDisconnected

I thought this would translate to

`resource "azurerm_eventgrid_event_subscription" "eventgrid-subscription" { name = local.eventgrid_subscription_name scope = azurerm_resource_group.devcon-rg.id service_bus_queue_endpoint_id = azurerm_servicebus_queue.infra-sb-queue.id retry_policy { max_delivery_attempts = 10 event_time_to_live = 120 } included_event_types = [ "Microsoft.Devices.DeviceConnected", "Microsoft.Devices.DeviceDisconnected", "Microsoft.Devices.DeviceCreated" ]

}`

However it does not! How can I specificy the IoTHub Ressource with this provider? With the CLI command it was --source-resource-id

I can specify the Topic Type as Azure IOTHUB in the Portal too image

hmrc87 commented 3 years ago

It was as simple as setting the scope to the iothub.id! scope = azurerm_iothub.iothub.id

ghost commented 3 years ago

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 šŸ‘‰ hashibot-feedback@hashicorp.com. Thanks!