generated from kedacore/github-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SpiritZhou <[email protected]>
- Loading branch information
1 parent
1e16d1d
commit ed2c9f6
Showing
6 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
provider "azurerm" { | ||
features {} | ||
skip_provider_registration = true | ||
} | ||
|
||
locals { | ||
event_grid_name = "${var.unique_project_name}-e2e-event-grid" | ||
event_grid_subscription_name = "${var.unique_project_name}-e2e-event-grid-subscription" | ||
} | ||
|
||
data "azurerm_resource_group" "rg" { | ||
name = var.resource_group_name | ||
} | ||
|
||
resource "azurerm_eventgrid_topic" "eventgrid" { | ||
name = local.event_grid_name | ||
location = data.azurerm_resource_group.rg.location | ||
resource_group_name = data.azurerm_resource_group.rg.name | ||
input_schema = "CloudEventSchemaV1_0" | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_eventgrid_event_subscription" "eventsubscription" { | ||
name = local.event_grid_subscription_name | ||
scope = azurerm_eventgrid_topic.eventgrid.id | ||
event_delivery_schema = "CloudEventSchemaV1_0" | ||
|
||
service_bus_topic_endpoint_id = var.service_bus_topic_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "roles" { | ||
count = length(var.event_grid_admin_identities) | ||
scope = azurerm_eventgrid_topic.eventgrid.id | ||
role_definition_name = "Azure Event Grid Owner" | ||
principal_id = var.event_grid_admin_identities[count.index].principal_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "endpoint" { | ||
value = azurerm_eventgrid_topic.eventgrid.endpoint | ||
} | ||
|
||
output "key" { | ||
value = azurerm_eventgrid_topic.eventgrid.primary_access_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
variable "resource_group_name" { | ||
type = string | ||
description = "Resource group name where event hub will be placed" | ||
} | ||
|
||
variable "unique_project_name" { | ||
type = string | ||
description = "Value to make unique every resource name generated" | ||
} | ||
|
||
variable "service_bus_topic_id" { | ||
type = string | ||
description = "Service bus topic to subscription events" | ||
} | ||
|
||
variable "tags" { | ||
type = map(any) | ||
description = "Tags to apply on every resource" | ||
} | ||
|
||
variable "event_grid_admin_identities" { | ||
type = list(any) | ||
description = "Azure Service Bus Data Owner identities" | ||
default = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
output "connection_string" { | ||
value = azurerm_servicebus_namespace_authorization_rule.manage.primary_connection_string | ||
} | ||
|
||
output "event_grid_receive_topic_id" { | ||
value = azurerm_servicebus_topic.topic.id | ||
} | ||
|
||
output "event_grid_receive_topic" { | ||
value = azurerm_servicebus_topic.topic.name | ||
} |