Skip to content

Commit b633708

Browse files
committed
keys
1 parent e9d76d8 commit b633708

4 files changed

Lines changed: 32 additions & 1 deletion

File tree

infrastructure/modules/arc-infra/relay.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ resource "azurerm_relay_hybrid_connection" "per_machine" {
4545
requires_client_authorization = true
4646
}
4747

48+
# Listen-only SAS rule per HC — retained for local development / break-glass access.
49+
# Production relay authentication uses Managed Identity (see relay_listener_role below).
50+
resource "azurerm_relay_hybrid_connection_authorization_rule" "per_machine_listen" {
51+
for_each = {
52+
for machine_name, machine_config in local.arc_machines :
53+
machine_name => machine_config
54+
if var.enable_relay_sas_keys
55+
}
56+
57+
name = "listen"
58+
hybrid_connection_name = azurerm_relay_hybrid_connection.per_machine[each.key].name
59+
namespace_name = local.relay_namespace_name
60+
resource_group_name = local.relay_namespace_rg
61+
62+
listen = true
63+
send = false
64+
manage = false
65+
}
66+
4867
# Look up each discovered Arc machine to obtain its system-assigned managed identity.
4968
# Static machines (registered in the same apply) are excluded — they are not yet
5069
# visible to the data source and will be picked up on the next apply after onboarding.

infrastructure/modules/arc-infra/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ variable "static_arc_machine_names" {
2828
type = list(string)
2929
default = []
3030
}
31+
32+
variable "enable_relay_sas_keys" {
33+
description = "Whether to create relay SAS keys for the Arc machines. Only used in the review environment."
34+
type = bool
35+
}

infrastructure/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "arc_infra" {
1111
env_config = var.env_config
1212
resource_group_name = local.resource_group_name
1313
enable_arc_servers = var.enable_arc_servers
14+
enable_relay_sas_keys = var.enable_relay_sas_keys
1415

1516
# Create the HC for the test VM in the same run as VM creation.
1617
# The Arc data source won't see a machine registered in the same apply.

infrastructure/terraform/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ variable "gateway_test_vm_size" {
5050
default = "Standard_B2s"
5151
}
5252

53+
variable "enable_relay_sas_keys" {
54+
description = "Whether to create relay SAS keys for the Arc machines"
55+
default = false
56+
type = bool
57+
}
58+
5359
locals {
5460
region = "uksouth"
5561
resource_group_name = "rg-${var.app_short_name}-${var.environment}-uks"
56-
}
62+
}

0 commit comments

Comments
 (0)