Error: Invalid template interpolation value: Cannot include the given value in a string template: string required

Hello everyone.

I am writing a script for creating a kubernetes cluster in oracle cloud.
When I run terraform plan, it returns no errors. But when I run terraform apply, it returns me the error:

Error: Invalid template interpolation value: Cannot include the given value in a string template: string required.

I enabled trace and log file generation to try to identify where the problem is, in trace it returns:

2019/11/21 20:31:15 [TRACE] EvalMaybeTainted: null_resource.k8sworker-ad1 [0] encountered an error during creation, so it is now marked as tainted
2019/11/21 20:31:15 [ERROR] : eval: * terraform.EvalApplyPost, err: 1 error occurred:

    Invalid template interpolation value: Cannot include the given value in a template: string required string.

2019/11/21 20:31:15 [TRACE] EvalMaybeTainted: null_resource.k8sworker-ad1 [1] encountered an error during creation, so it is now marked as tainted
2019/11/21 20:31:15 [ERROR] : eval: * terraform.EvalSequence, err: Invalid template interpolation value: Cannot include the given value in a string template: string required.

I believe the problem is in this part of the code:

resource "null_resource" "k8sworker-ad1" {
  count      = var.k8sWorkerAd1Count
  depends_on = [module.instances-k8sworker-ad1]

  triggers = {
    worker_id       = module.instances-k8sworker-ad1.ids[0][count.index]
    build_source_id = null_resource.build_source.id
  }

  provisioner "local-exec" {
    command = "echo 'alias ${var.label_prefix}workerad1-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad1.public_ips, count.index)}\"' >> source.sh"
  }
}

Terraform Version:

Terraform v0.12.16
+ provider.null v2.1.2
+ provider.oci v3.52.0
+ provider.random v2.2.1
+ provider.template v2.1.2
+ provider.tls v2.1.1

Debug Output:

Please help me solve this problem.