Invalid Count Argument

I am trying to feed an output from one of my modules to input into my count for a module that runs right after it. But I seem to get into a “Invalid Count Argument” when I try to do this, since I guess Terraform does not know the count until terraform apply? Here is the error message below I am getting.

Error: Invalid count argument

  on ..\..\modules\centos-host\centos-host-configure\main.tf line 14, in resource "null_resource" "az-centos-script-download":
  14:   count = length(var.centos-host-vm-ids)

The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.

Any advice on how to get this sort of logic working with Terraforms?