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_schemaoptional - string -
eventhub_endpoint_idoptional computed - string -
expiration_time_utcoptional - string -
hybrid_connection_endpoint_idoptional computed - string -
idoptional computed - string -
included_event_typesoptional computed - list of string -
labelsoptional - list of string -
namerequired - string -
scoperequired - string -
service_bus_queue_endpoint_idoptional - string -
service_bus_topic_endpoint_idoptional - string -
topic_nameoptional computed - string -
advanced_filterlist block-
bool_equalslist block -
number_greater_thanlist block -
number_greater_than_or_equalslist block -
number_inlist block -
number_less_thanlist block -
number_less_than_or_equalslist block -
number_not_inlist block -
string_begins_withlist block -
string_containslist block -
string_ends_withlist block -
string_inlist block -
string_not_inlist block
-
-
azure_function_endpointlist block-
function_idrequired - string -
max_events_per_batchoptional - number -
preferred_batch_size_in_kilobytesoptional - number
-
-
eventhub_endpointlist block-
eventhub_idoptional computed - string
-
-
hybrid_connection_endpointlist block-
hybrid_connection_idoptional computed - string
-
-
retry_policylist block-
event_time_to_liverequired - number -
max_delivery_attemptsrequired - number
-
-
storage_blob_dead_letter_destinationlist block-
storage_account_idrequired - string -
storage_blob_container_namerequired - string
-
-
storage_queue_endpointlist block-
queue_namerequired - string -
storage_account_idrequired - string
-
-
subject_filterlist block-
case_sensitiveoptional - bool -
subject_begins_withoptional - string -
subject_ends_withoptional - string
-
-
timeoutssingle block -
webhook_endpointlist block-
active_directory_app_id_or_urioptional - string -
active_directory_tenant_idoptional - string -
base_urloptional computed - string -
max_events_per_batchoptional - number -
preferred_batch_size_in_kilobytesoptional - number -
urlrequired - 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
apiVersionrequired - stringidentityoptionalprincipalIdoptional - stringThe principal ID of resource identity.
tenantIdoptional - stringThe tenant ID of resource.
typeoptional - 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.
userAssignedIdentitiesoptional - 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.
locationrequired - stringLocation of the resource.
namerequired - stringName of the topic.
propertiesrequireddisableLocalAuthoptional - 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.
inboundIpRulesoptional arrayactionoptional - stringAction to perform based on the match or no match of the IpMask.
ipMaskoptional - stringIP Address in CIDR notation e.g., 10.0.0.0/8.
inputSchemaoptional - stringThis determines the format that Event Grid should expect for incoming events published to the topic.
inputSchemaMappingoptionalpublicNetworkAccessoptional - 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" />.
tagsoptional - stringTags of the resource.
typerequired - 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.