Terraform-provider-azurerm: New Resource: EventGrid Subscriptions

Created on 19 Aug 2018  ·  7Comments  ·  Source: terraform-providers/terraform-provider-azurerm

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

Description

There appears to currently be no support for creating azure event grid subscriptions (e.g. subscribing to storage account blob create/delete events)

New or Affected Resource(s)

  • azurerm_eventgrid_subscription (new)

Potential Terraform Configuration

resource "azurerm_eventgrid_subscription" "test" {
    name = "test"
    resource_group_name = "${azurerm_resource_group.test.name}"
    location = "${azurerm_resource_group.test.location}"
    topic = "${azurerm_storage_account.test.id}" # resource id
    destination = {
        endpointType = "WebHook"
        endpointUrl = "https://<webhook-url>"
        # or the following for event hub subscriptions
        #endpointType = "EventHub"
        #resourceId = ""
    }
    # filter should be optional
    filter = {
        includedEventTypes = [ "all" ] # default
        subjectBeginsWith = "" # default
        subjectEndsWith = "" # default
        isSubjectCaseSensitive = true # applies to subject begins/ends with
    }
    # labels should be optional
    labels = [ "label1", "label2" ]
}

References

new-resource servicevent-grid

All 7 comments

I need it and link it to route Azure activity logs to an enventhub sitting in another subscription.

In the EventSubscription details I want to be able to specify the Event Schema to "Same as Input Schema"

I need the similar resource, but with the end point is queue.

As a workaround I created the Event Grid Subscription using the 'azurerm_template_deployment' resource. My use case was from Azure Storage to Event Hub. I've generalized it and uploaded a gist here: https://gist.github.com/timmyreilly/6839d0e6014167ecf68f720cb0f7794f

@phosphre is right! Check his reply below before continuing with this approach.

@timmyreilly an interesting sojourn, but for other readers finding themselves here, we are wise to note the warning on the HashiCorp doc on azurerm_template_deployment resources in respect of resources unmanaged by TF being left behind and requiring separate clean up.

Hey all, thanks for opening this issue. Event subscriptions for EventGrid has been merged via #2967 and will make it into the next release.

This has been released in version 1.23.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 = "~> 1.23.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!

Was this page helpful?
0 / 5 - 0 ratings