Loop though nested map to build Security Groups


I am trying to figure out how to loop through a nested Map of Security Groups in order to build them out from a higher module where actual variables are contained. In this lower-level module, I want to cut the config lines down with iteration. An example map in variables.tf is below:

variable s_groups_dev {
default = {
“kube_master” = {
“name” = “kube_master”
“description” = “Security Group for Kube Master”
“vpc_id” = “vpc-03da2faf5b1c79290”
“kube_master_instance_access_egress” = {
"name " = “kube_master_instance_access_egress”
“description” = “desc”
“vpc_id” = “vpc-03da2faf5b1c79290”

I want to loop thorugh the keys kube-master, and kube_master_instance_access_egress in the map s_groups_dev. While on kube-master, I need to build a SG for it using the 3 maps (name, description, and vpc_id). I don’t know how to do this in Terraform and have been looking everywhere. I think 'for k1, k2, v in s_groups_dev could work, but don’t know how to make it work for the 3 lower maps mentioned above.

Any help would be awesome