File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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+
5359locals {
5460 region = " uksouth"
5561 resource_group_name = " rg-${ var . app_short_name } -${ var . environment } -uks"
56- }
62+ }
You can’t perform that action at this time.
0 commit comments