Multiple resource definitions with same domain merge together?
compscidr opened this issue · 0 comments
compscidr commented
Hey there, I have a usecase where I would like to define groups of subdomains with various counts, however if I have multiple resource blocks, because of the design choice to clear everything, it does not work. For instance:
resource "godaddy_domain_record" "block1" {
domain = "somedomain.xyz"
count = var.test_runner_count
record {
name = "block1-${count.index + 1}"
type = "A"
data = aws_instance.test-runner[count.index].public_ip
ttl = 3600
}
}
resource "godaddy_domain_record" "block2" {
domain = "somedomain.xyz"
count = var.other_hosts_count
record {
name = "block2-${count.index + 1}"
type = "A"
data = aws_instance.other_hosts[count.index].public_ip
ttl = 3600
}
}
resource "godaddy_domain_record" "static-records" {
domain = "somedomain.xyz"
// static records
record {
name = "app"
type = "A"
data = "8.8.8.8"
ttl = 600
}
}
So when I apply this, I end up with some mixture of whatever applies first (it usually removes some missing entries, and adds some. Is there any way that all resources with the same domain could be merged together instead of all executed separately?
I don't mind submitting a PR, I'd just need to do some digging into the code to see how hard it would be / if possible.