How can I define multiple instances in multiple regions? I want to avoid code duplication for better management. I’ve tried to make the module but I got
│ Providers cannot be configured within modules using count, for_each or depends_on.
resource "linode_instance” "server_ap_west" {
count = 3
label = "server-ap-west-${count.index}"
region = "ap-west"
image = "linode/ubuntu21.10"
type = "g6-nanode-1"
tags = ["prod"]
root_pass = var.linode_instance_root_password
stackscript_id = linode_stackscript.nodejs_script.id
}
resource "cloudflare_record” "server_ap_west" {
zone_id = var.cloudflare_zone_id
name = "server-ap-west-${count.index}"
count = "${length(linode_instance.server_ap_west)}"
value = "${linode_instance.server_ap_west[count.index].ip_address}"
ttl = 1
type = "A"
}
..same code for eu-west
..same code for us-east