locals { rule_count = length(var.rules) } resource "stackit_security_group" "this" { project_id = var.project_id name = var.name description = var.description } resource "stackit_security_group_rule" "rule" { count = local.rule_count direction = var.rules[count.index].direction project_id = var.project_id security_group_id = stackit_security_group.this.security_group_id description = var.rules[count.index].description ether_type = var.rules[count.index].ether_type icmp_parameters = var.rules[count.index].icmp_parameters ip_range = var.rules[count.index].ip_range port_range = var.rules[count.index].port_range protocol = var.rules[count.index].protocol remote_security_group_id = var.rules[count.index].remote_security_group_id }