Skip to content

Instantly share code, notes, and snippets.

@arnaudmorin
Created September 15, 2020 11:24
Show Gist options
  • Save arnaudmorin/236ee5c1794d5cca5179334483daa916 to your computer and use it in GitHub Desktop.
Save arnaudmorin/236ee5c1794d5cca5179334483daa916 to your computer and use it in GitHub Desktop.
terraform multiple regions at once
# Configure the OpenStack Provider
# It will read info from env OS_xxx
provider "openstack" {
}
#
# BACKENDS
#
# Create one server per region
resource "openstack_compute_instance_v2" "servers" {
name = "${format("server-%s", element(var.regions, count.index))}"
count = "${length(var.regions)}"
region = "${element(var.regions, count.index)}"
image_name = "Debian 10"
flavor_name = "c2-7"
network { name = "Ext-Net" }
}
variable "regions" {
default = [
"UK1",
"SGP1"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment