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.6k stars 4.65k forks source link

azurerm_eventgrid_event_subscription binding to eventgrid topic endpoint missing #16201

Open dharmesh019 opened 2 years ago

dharmesh019 commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

v1.1.7

AzureRM Provider Version

3.0.0

Affected Resource(s)/Data Source(s)

azurerm_eventgrid_event_subscription

Terraform Configuration Files

eventgrid_endpoint_id is missing as input to bind to eventgrid topic.

Debug Output/Panic Output

eventgrid_endpoint_id is missing as input to bind to eventgrid topic.

Expected Behaviour

it should allow to bind eventgrid_endpoint_id to event subscription but it has only eventhub_endpoint_id to bind with and eventgrid topic binding is missing.

Actual Behaviour

it does not allow to have binding with eventgrid topic endpoint to recieve the events from eventgrid.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

xiaxyi commented 2 years ago

@dharmesh019 are you suggesting to send the events back to event grid by using the event grid topic id in event grid subscription ?

xiaxyi commented 2 years ago

@dharmesh019 I don't see event_grid is supported as an endpoint in rest api.

The supported endpoints are:

EventSubscriptionDestination: WebHookEventSubscriptionDestination EventHubEventSubscriptionDestination StorageQueueEventSubscriptionDestination HybridConnectionEventSubscriptionDestination ServiceBusQueueEventSubscriptionDestination ServiceBusTopicEventSubscriptionDestination AzureFunctionEventSubscriptionDestination PartnerEventSubscriptionDestination

Can you be more specific about your requirement?

kratkyzobak commented 1 year ago

Got here from googling as name/documentation of azurerm_eventgrid_event_subscription can be confusing for anyone starting with eventgrid in terraform (valid for me). It seems, author of this issue ment bind as filter to specific topic. For anyone who came searching for "How to filter azurerm_eventgrid_event_subscription to topic or domain" - use scope field.

jephlu commented 1 year ago

I tested the azurerm_eventgrid_event_subscription, it creates 2 Azure ressources :

Also, these 2 resources can be deployed by these tf ressources

This naming is really better to understand.

So, the azurerm_eventgrid_event_subscription seems to be useless... and cannot be used to link to an eventgrid topic.

I Join @dharmesh019 on this need, regarding the others resources :

So, you can build the publishing part for a topic / domain / domain topic, but there is no tf ressource to create the subscribers for theses. You have a half Azure ressource, not totally functional.

It could be by adding the following tf resources to the provider :

Let me know @xiaxyi if it helps to the need !

kratkyzobak commented 1 year ago

You can subscribe to domain/domain topic/topic using azurerm_eventgrid_event_subscription.

Just pass domain/domain topic/topic id into scope field of azurerm_eventgrid_event_subscription

jephlu commented 1 year ago

Ok, i misunderstood this parameter ! In the documentation , the scope parameter uses a resource group, and in this case it creates on top of the event subscription an EG system topic. It misled me... I think it was to scope azure resource group / subscription / management group. I tested with scopes on domain/domain topic/topic and yes it works... But seems not with an existing System topic (the other resource azurerm_eventgrid_system_topic_event_subscription can manage it) Thanks for the info 👍 Maybe it could be good to improve doc on this parameter to better explain it ;)