terraform has resource and data. resource creates a new thing, while data refers to an existing thing.
Is it possible to do the following? 1) if a resource does not exit, create a new one by 'resource' 2) if it exists, refer to it by 'data'
For example,
# if not exists
resource "a" "b" { name = ...}
# else
data "a" "b" {name = ...}
resource "c" "d" {
field = "${element(concat(a.b.*.name, data.a.b.*.name), 0)}"
}