Description
Terraform Version
1.11.3
Terraform Configuration Files
resource "openstack_dns_recordset_v2" "kubernetes_controlplane" {
zone_id = var.dns_zone.id
name = "${var.cluster_name}.${var.dns_zone.name}"
ttl = 300
type = "A"
records = concat(
[module.primary_server.private_ip],
[for server in module.secondary_server : server.private_ip],
)
}
Expected Behavior
The module has a private_ip
resource that is created independently of the openstack_dns_recordset_v2
. However the full module cannot complete until the dns recordset is created. The recordset should be able to be created early because the private_ip of all the dependent resources are available.
Actual Behavior
While this works properly for the primary_server, for the secondary_servers the entire module must have completed before the recordset is created by Terraform. It seems that the for
keywords does not generate the list of private_ips until the entire module list has been created, even though it has access to all the private_ips it needs
Steps to Reproduce
- Create a module that has 2 resources, 1 which creates early and one which creates later
- Create a resource that depends on a list of the early created resources
- Note that the creation of the object gets stuck, even though all necessary resources are available.
Additional Context
Our module does not fully complete until the dns_record is present because we have a provisioner that uses the dns record. Since this is a provisioner, Terraform is obviously not aware that the modules depend on the dns record being created, which is also why this does not fail with a cyclic dependency.
References
No response
Generative AI / LLM assisted development?
No response