Skip to content

Commit

Permalink
fix errors with subnet delegation (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Swen Jedlicka <swen.jedlicka@telekom.de>
  • Loading branch information
sjedlick and Swen Jedlicka authored May 17, 2023
1 parent c91abf5 commit cebfc2d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ resource "azurerm_subnet" "subnet" {


dynamic "delegation" {
for_each = local.subnet[each.key].delegation.name == "" ? [] : [0]
for_each = local.subnet[each.key].delegation

content {
name = local.subnet[each.key].delegation.name == "" ? delegation.key : local.subnet[each.key].delegation.name
name = local.subnet[each.key].delegation[delegation.key].name == "" ? delegation.key : local.subnet[each.key].delegation[delegation.key].name

service_delegation {
name = local.subnet[each.key].delegation.service_delegation.name
actions = local.subnet[each.key].delegation.service_delegation.actions
name = local.subnet[each.key].delegation[delegation.key].service_delegation.name
actions = local.subnet[each.key].delegation[delegation.key].service_delegation.actions
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ locals {
local.subnet_values[subnet],
{
for config in ["delegation"] :
config => merge(
merge(local.default.subnet[config], local.subnet_values[subnet][config]),
{
for subconfig in ["service_delegation"] :
subconfig => merge(local.default.subnet[config][subconfig], local.subnet_values[subnet][config][subconfig])
}
)
config => keys(local.subnet_values[subnet][config]) == keys(local.default.subnet[config]) ? {} : {
for key in keys(local.subnet_values[subnet][config]) :
key => merge(
merge(local.default.subnet[config], local.subnet_values[subnet][config][key]),
{
for subconfig in ["service_delegation"] :
subconfig => merge(local.default.subnet[config][subconfig], local.subnet_values[subnet][config][key][subconfig])
}
)
}
}
)
}
Expand Down

0 comments on commit cebfc2d

Please sign in to comment.