Azure Messaging Event Subscription
This page shows how to write Terraform and Azure Resource Manager for Messaging Event Subscription and write them securely.
azurerm_eventgrid_event_subscription (Terraform)
The Event Subscription in Messaging can be configured in Terraform with the resource name azurerm_eventgrid_event_subscription
. The following sections describe 7 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_eventgrid_event_subscription" "always_succeeds_subscription" {
name = "alwaysSucceedsSubscription"
scope = azurerm_eventgrid_topic.events_sample.id
event_delivery_schema = "EventGridSchema"
webhook_endpoint {
url="<always-succeeds-url>"
resource "azurerm_eventgrid_event_subscription" "evnt_sub" {
name = var.name
scope = var.scope
event_delivery_schema = var.event_delivery_schema
included_event_types = var.included_event_types
resource "azurerm_eventgrid_event_subscription" "sub" {
name = "event-yourname-sample"
scope = azurerm_eventgrid_topic.default-event-grid.id
storage_queue_endpoint {
storage_account_id = azurerm_storage_account.default.id
resource "azurerm_eventgrid_event_subscription" "event-subscription" {
for_each = var.event_subscriptions
name = format("%s%s", each.key, var.environment)
scope = each.value["scope"]
advanced_filtering_on_arrays_enabled = each.value["advanced_filtering_on_arrays_enabled"]
event_delivery_schema = each.value["event_delivery_schema"]
resource "azurerm_eventgrid_event_subscription" "j1dev_domain_topic_subscription" {
count = local.event_grid_domain_count
name = "j1dev-event-grid-domain-topic-subscription"
scope = azurerm_eventgrid_domain_topic.j1dev[count.index].id
storage_queue_endpoint {
resource "azurerm_eventgrid_event_subscription" "this" {
event_delivery_schema = var.event_delivery_schema
included_event_types = var.included_event_types
labels = var.labels
name = var.name
scope = var.scope
resource "azurerm_eventgrid_event_subscription" "this" {
event_delivery_schema = var.event_delivery_schema
included_event_types = var.included_event_types
labels = var.labels
name = var.name
scope = var.scope
Parameters
-
event_delivery_schema
optional - string -
eventhub_endpoint_id
optional computed - string -
expiration_time_utc
optional - string -
hybrid_connection_endpoint_id
optional computed - string -
id
optional computed - string -
included_event_types
optional computed - list of string -
labels
optional - list of string -
name
required - string -
scope
required - string -
service_bus_queue_endpoint_id
optional - string -
service_bus_topic_endpoint_id
optional - string -
topic_name
optional computed - string -
advanced_filter
list block-
bool_equals
list block -
number_greater_than
list block -
number_greater_than_or_equals
list block -
number_in
list block -
number_less_than
list block -
number_less_than_or_equals
list block -
number_not_in
list block -
string_begins_with
list block -
string_contains
list block -
string_ends_with
list block -
string_in
list block -
string_not_in
list block
-
-
azure_function_endpoint
list block-
function_id
required - string -
max_events_per_batch
optional - number -
preferred_batch_size_in_kilobytes
optional - number
-
-
eventhub_endpoint
list block-
eventhub_id
optional computed - string
-
-
hybrid_connection_endpoint
list block-
hybrid_connection_id
optional computed - string
-
-
retry_policy
list block-
event_time_to_live
required - number -
max_delivery_attempts
required - number
-
-
storage_blob_dead_letter_destination
list block-
storage_account_id
required - string -
storage_blob_container_name
required - string
-
-
storage_queue_endpoint
list block-
queue_name
required - string -
storage_account_id
required - string
-
-
subject_filter
list block-
case_sensitive
optional - bool -
subject_begins_with
optional - string -
subject_ends_with
optional - string
-
-
timeouts
single block -
webhook_endpoint
list block-
active_directory_app_id_or_uri
optional - string -
active_directory_tenant_id
optional - string -
base_url
optional computed - string -
max_events_per_batch
optional - number -
preferred_batch_size_in_kilobytes
optional - number -
url
required - string
-
Explanation in Terraform Registry
Manages an EventGrid Event Subscription
Microsoft.EventGrid/topics (Azure Resource Manager)
The topics in Microsoft.EventGrid can be configured in Azure Resource Manager with the resource name Microsoft.EventGrid/topics
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
apiVersion
required - stringidentity
optionalprincipalId
optional - stringThe principal ID of resource identity.
tenantId
optional - stringThe tenant ID of resource.
type
optional - stringThe type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity.
userAssignedIdentities
optional - undefinedThe list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. This property is currently not used and reserved for future usage.
location
required - stringLocation of the resource.
name
required - stringName of the topic.
properties
requireddisableLocalAuth
optional - booleanThis boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic.
inboundIpRules
optional arrayaction
optional - stringAction to perform based on the match or no match of the IpMask.
ipMask
optional - stringIP Address in CIDR notation e.g., 10.0.0.0/8.
inputSchema
optional - stringThis determines the format that Event Grid should expect for incoming events published to the topic.
inputSchemaMapping
optionalpublicNetworkAccess
optional - stringThis determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring <seealso cref="P:Microsoft.Azure.Events.ResourceProvider.Common.Contracts.TopicProperties.InboundIpRules" />.
tags
optional - stringTags of the resource.
type
required - string
Frequently asked questions
What is Azure Messaging Event Subscription?
Azure Messaging Event Subscription is a resource for Messaging of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Messaging Event Subscription?
For Terraform, the tomijuarez/quilmes-messaging-poc, bryannice/terraform-azure-modules and rafaelvelosoAZ/NewOne source code examples are useful. See the Terraform Example section for further details.