Need to create dynamic network using terraform 0.12

Hi all,

my piece of code which works perfectly well in terraform 0.11 however it fails for terraform v 0.12.
This is related to creating an option of dynamic network , meaning on the variable external_ip it determines whether the instance will have a public ip or a private ip.

The snippet of the code is as under
locals {
access_config {
“0” =
“1” = [{}]
then the network_interface block
network_interface {
subnetwork = “{var.subnetwork}" access_config = "{local.access_config[var.external_ip]}”

this is the exception for terraform v 0.12
106: access_config = “${local.access_config[var.external_ip]}”

   An argument named "access_config" is not expected here. Did you mean to define
   a block of type "access_config"?

kindly suggest a fix