This Terraform module creates an Azure Event Grid system topic with an Azure Event Grid system topic event subscription and activated Diagnostics Logs.
You can create an Azure Event Grid system topic event subscription without Event Grid system topic by using the submodule modules/event-subscription
.
Module version | Terraform version | OpenTofu version | AzureRM version |
---|---|---|---|
>= 8.x.x | Unverified | 1.8.x | >= 4.0 |
>= 7.x.x | 1.3.x | >= 3.0 | |
>= 6.x.x | 1.x | >= 3.0 | |
>= 5.x.x | 0.15.x | >= 2.0 | |
>= 4.x.x | 0.13.x / 0.14.x | >= 2.0 | |
>= 3.x.x | 0.12.x | >= 2.0 | |
>= 2.x.x | 0.12.x | < 2.0 | |
< 2.x.x | 0.11.x | < 2.0 |
If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.
More details are available in the CONTRIBUTING.md file.
This module is optimized to work with the Claranet terraform-wrapper tool
which set some terraform variables in the environment needed by this module.
More details about variables set by the terraform-wrapper
available in the documentation.
module "eventgrid" {
source = "claranet/eventgrid/azurerm"
version = "x.x.x"
resource_group_name = module.rg.name
stack = var.stack
environment = var.environment
client_name = var.client_name
location = module.region.location
location_short = module.region.location_short
source_resource_id = module.keyvault.id
storage_queue_endpoint = {
storage_account_id = azurerm_storage_account.storage_acount.id
queue_name = azurerm_storage_queue.storage_queue.name
}
logs_destinations_ids = [
module.logs.storage_account_id,
module.logs.id,
]
}
Name | Version |
---|---|
azurecaf | ~> 1.2.28 |
azurerm | ~> 4.0 |
Name | Source | Version |
---|---|---|
diagnostics | claranet/diagnostic-settings/azurerm | ~> 8.0.0 |
event_subscription | ./modules/event-subscription | n/a |
Name | Type |
---|---|
azurerm_eventgrid_system_topic.main | resource |
azurecaf_name.eventgrid | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
advanced_filter | Filter a value of an event for an Event Subscription based on a condition. | object({ |
null |
no |
advanced_filtering_on_arrays_enabled | Specifies whether advanced filters should be evaluated against an array of values instead of expecting a singular value. | bool |
null |
no |
azure_function_endpoint | Function where the Event Subscription will receive events. | object({ |
null |
no |
client_name | Client name/account used in naming. | string |
n/a | yes |
custom_name | Custom Azure Event Grid name, generated if not set. | string |
"" |
no |
default_tags_enabled | Option to enable or disable default tags. | bool |
true |
no |
delivery_property | Option to set custom headers on delivered events. | list(object({ |
[] |
no |
diagnostic_settings_custom_name | Custom name of the diagnostics settings, name will be default if not set. |
string |
"default" |
no |
environment | Project environment. | string |
n/a | yes |
event_delivery_schema | Specifies the event delivery schema for the Event Subscription. Possible values include: EventGridSchema , CloudEventSchemaV1_0 , CustomInputSchema . |
string |
"EventGridSchema" |
no |
event_subscription_custom_name | Event subscription optional custom name. | string |
"" |
no |
eventhub_endpoint_id | ID of the Event Hub where the Event subscription will receive events. | string |
null |
no |
expiration_time_utc | Specifies the expiration time of the Event Subscription (Datetime Format RFC 3339). | string |
null |
no |
extra_tags | Additional tags to associate with your Azure Eventgrid. | map(string) |
{} |
no |
hybrid_connection_endpoint_id | ID of the Hybrid Connection where the Event subscription will receive events. | string |
null |
no |
included_event_types | List of applicable event types that need to be part of the Event Subscription. | list(string) |
[] |
no |
labels | List of labels to assign to the Event Subscription. | list(string) |
[] |
no |
location | Azure location. | string |
n/a | yes |
location_short | Short string for Azure location. | string |
n/a | yes |
logs_categories | Log categories to send to destinations. | list(string) |
null |
no |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account , Log Analytics Workspace and Event Hub . No more than one of each can be set.If you want to use Azure EventHub as a destination, you must provide a formatted string containing both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character. |
list(string) |
n/a | yes |
logs_metrics_categories | Metrics categories to send to destinations. | list(string) |
null |
no |
name_prefix | Optional prefix for the generated name. | string |
"" |
no |
name_suffix | Optional suffix for the generated name. | string |
"" |
no |
resource_group_name | Resource Group name. | string |
n/a | yes |
retry_policy | Delivery retry attempts for events. | object({ |
null |
no |
service_bus_queue_endpoint_id | ID of the Service Bus Queue where the Event subscription will receive events. | string |
null |
no |
service_bus_topic_endpoint_id | ID of the Service Bus Topic where the Event subscription will receive events. | string |
null |
no |
source_resource_id | ID of the Event Grid System Topic ARM Source. | string |
n/a | yes |
stack | Project Stack name. | string |
n/a | yes |
storage_blob_dead_letter_destination | Storage blob container that is the destination of the deadletter events. | object({ |
null |
no |
storage_queue_endpoint | Storage Queue endpoint block configuration where the Event subscription will receive events. | object({ |
null |
no |
subject_filter | Block to filter events for an Event Subscription based on a resource path prefix or suffix. | object({ |
null |
no |
webhook_endpoint | Webhook configuration block where the Event Subscription will receive events. | object({ |
null |
no |
Name | Description |
---|---|
id | Azure Event Grid System Topic ID. |
identity_principal_id | Azure Event Grid System Topic identity's principal ID. |
metric_arm_resource_id | Azure Event Grid System Topic's metric ARM resource ID. |
module_diagnostics | Diagnostics Settings module output. |
module_event_subscription | Event Subscription module output. |
name | Azure Event Grid System Topic name. |
resource | Azure Event Grid System Topic resource object. |