Dynamic object containing dynamic content

I have a dynamic object, however I’ve found that simply having a empty object causes GCP to enable the network security even when there’s no ranges specified, so I need to make the entire block dynamic instead.

master_authorized_networks_config {
  dynamic cidr_blocks {
    for_each = var.access_cidr_blocks
    content {
      cidr_block   = cidr_blocks.value.cidr_block
      display_name = cidr_blocks.value.display_name
    }
  }
}

So essentially I want to move the dynamic to the master_authorized_networks_config block instead, but I can’t figure out how to do so, while continuing to correctly create the content of said block.

Please help :wink:

Hi @djsmiley2k!

Can you share what you tried already and what errors you saw when you tried? The dynamic block syntax should be similar for the outer block too so if it isn’t working it would be helpful to see what exactly isn’t working about it. Thanks!