Error when trying to get values from an array created inside the command block of local-exec provisioner

Getting the below error when trying to get a value from the current_state array which is a variable defined inside the command block.
The reason is that Terraform is looking for the definition of this variable current_state in the terraform file but that variable is being created inside the command block.
I tried to omit the brackets like this echo "$current_state[2]" but bash needs them in order to properly access the array.

Is there a way to tell terraform to not treat this variable "${current_state[2]}" as a Terraform variable?

Error:

echo "${current_state[2]}"

A reference to a resource type must be followed by at least one attribute
access, specifying the resource name. 

Terraform Code:

resource "null_resource" "command" {
  for_each       = var.node_pools.node_pools
  depends_on = [oci_containerengine_node_pool.nodepools]
  triggers = {
    always_run = "${timestamp()}"
  }

  provisioner "local-exec" {
  command = <<EOT
    current_state=""
    state+=( $(oci ce node-pool get --node-pool-id ${oci_containerengine_node_pool.nodepools[each.key].id} --query "data.nodes[].\"lifecycle-state\"") )
    current_state=$state[1]
    echo "${current_state[2]}"
   EOT
  }
}

Thanks in advance