Module Dependencies


Modules can't have a depends_on block in them and as such, need to have their dependencies defined in alternative ways as described in #10462. There are several ways to get around it though including using null_resources that don't actually do anything but resolve the graph appropriately per the example below.

module "ansible_configuration" {
...
}

resource "null_resource" "dependency_hack" {
  triggers = {
    apply_time = timestamp()
  }

  provisioner "local-exec" {
    command = <<-EOT
echo ${module.ansible_configuration.status}
EOT
  }
}

resource "aws_eip_association" "main" {
  instance_id = module.ec2.instance_id
  allocation_id = var.eip_id

  depends_on = [null_resource.dependency_hack]
}

Data References


Every data reference needs to be uniquely satisfied and return a value otherwise it will return an error. You can now put count values into data sources which allows you to toggle whether the data source is called allowing you to put in data source and have it be set based on a condition.