Created
March 4, 2018 12:13
-
-
Save sreimers/c16ddc69f71a2fc841fa0246317f5e4f to your computer and use it in GitHub Desktop.
Hetzner Cloud Terraform multiple servers and datacenters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "hcloud_token" {} | |
variable "zones" { | |
default = { | |
zone0 = "nbg1-dc3" | |
zone1 = "fsn1-dc8" | |
} | |
} | |
# Configure the Hetzner Cloud Provider | |
provider "hcloud" { | |
token = "${var.hcloud_token}" | |
} | |
# Create a web server | |
resource "hcloud_server" "web" { | |
count = 4 | |
name = "web${count.index}" | |
datacenter = "${lookup(var.zones, "zone${count.index % 2}")}" | |
image = "centos-7" | |
server_type = "cx11" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment