Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Iac/order-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ order-service/
- a **system-assigned managed identity**
- **ACR pull** via the `acr-password` secret + `registry` block (admin creds)
- external **ingress** on port 8080
- env vars: `ASPNETCORE_ENVIRONMENT`, `BotNetApi__BaseUrl`
- env vars: `ASPNETCORE_ENVIRONMENT`, `BotNetApi__BaseUrl`,
`StatusConsumer__EventHubName` (`robot-output`),
`StatusConsumer__ConsumerGroup` (`order-service`)
- secret-backed env vars: `ConnectionStrings__DefaultConnection`,
`EventHub__ConnectionString`
`EventHub__ConnectionString`, `StatusConsumer__ConnectionString`
- `azurerm_eventhub_consumer_group.order_service_status` — a dedicated
`order-service` consumer group on the simulator's `robot-output` hub, which the
app's status consumer reads to advance order status (#41).

The **image tag is owned by the CD pipeline**, not Terraform — the module sets
an initial `:latest` image and `ignore_changes` on it so `terraform apply`
Expand Down
22 changes: 20 additions & 2 deletions Iac/order-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ data "azurerm_container_registry" "acr" {
resource_group_name = data.azurerm_resource_group.rg.name
}

# Dedicated consumer group for the Order Service's status consumer (#41).
# The namespace and the robot-output hub pre-exist on the shared simulator
# namespace (created outside this stack); we only add our own consumer group so
# our read offsets stay isolated from $Default and other features
# (e.g. readable-bot-network-dev).
resource "azurerm_eventhub_consumer_group" "order_service_status" {
name = var.status_consumer_group_name
namespace_name = var.event_hub_namespace_name
eventhub_name = var.status_event_hub_name
resource_group_name = data.azurerm_resource_group.rg.name
}

module "order_service_app" {
source = "./modules/container-app"

Expand All @@ -42,13 +54,19 @@ module "order_service_app" {
}

env_vars = {
"ASPNETCORE_ENVIRONMENT" = "Production"
"BotNetApi__BaseUrl" = var.botnet_api_url
"ASPNETCORE_ENVIRONMENT" = "Production"
"BotNetApi__BaseUrl" = var.botnet_api_url
"StatusConsumer__EventHubName" = var.status_event_hub_name
"StatusConsumer__ConsumerGroup" = azurerm_eventhub_consumer_group.order_service_status.name
}

secret_env_vars = {
"ConnectionStrings__DefaultConnection" = "sql-connection-string"
"EventHub__ConnectionString" = "eventhub-connection-string"
# Reuse the namespace-level Event Hub connection string — it has Listen on
# all hubs in the namespace, incl. robot-output. If it is later scoped to a
# Listen-only SAS, introduce a separate secret/variable for this.
"StatusConsumer__ConnectionString" = "eventhub-connection-string"
}

tags = var.tags
Expand Down
20 changes: 19 additions & 1 deletion Iac/order-service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,29 @@ variable "sql_connection_string" {
}

variable "eventhub_connection_string" {
description = "Connection string for the robot-input Event Hub — passed in from the CD pipeline, never committed."
description = "Namespace-level Event Hub connection string — passed in from the CD pipeline, never committed. Used to publish to robot-input AND to consume robot-output (Listen) for order status updates."
type = string
sensitive = true
}

variable "event_hub_namespace_name" {
description = "Event Hub namespace hosting the simulator's robot-input/robot-output hubs."
type = string
default = "DeliverybotSimulator-EVHNS"
}

variable "status_event_hub_name" {
description = "Hub the simulator publishes bot status events to; the Order Service consumes it to advance order status (#41)."
type = string
default = "robot-output"
}

variable "status_consumer_group_name" {
description = "Dedicated consumer group the Order Service reads status events with — kept separate from $Default and other features."
type = string
default = "order-service"
}

variable "tags" {
description = "Common tags applied to Order Service resources."
type = map(string)
Expand Down
Loading
Loading