Given this resource:
resource "google_compute_instance" "instance" {
...
network_interface {
...
access_config {
...
}
}
}
I'd like to conditionally define the access_config property based on a condition.
[Edit] Solution
resource "google_compute_instance" "instance" {
...
network_interface {
...
dynamic "access_config" {
for_each = var.condition ? [1] : []
content {
...
}
}
}
}