code-server-test/main.tf
2021-12-01 12:36:12 +01:00

55 lines
974 B
HCL

terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.32.1"
}
}
}
variable "token" {
type = string
}
provider "hcloud" {
token = var.token
}
resource "hcloud_server" "ubuntu_server" {
name = "jk-test1"
image = "ubuntu-20.04"
server_type = "cpx11"
network {
network_id = hcloud_network.network.id
}
user_data = file("cloud-init-sv")
depends_on = [
hcloud_server.ubuntu_mysql
]
}
resource "hcloud_server" "ubuntu_mysql" {
name = "jk-test2"
image = "ubuntu-20.04"
server_type = "cpx11"
user_data = file("cloud-init-db")
network {
network_id = hcloud_network.network.id
}
}
resource "hcloud_network" "network" {
name = "jk-test3"
ip_range = "10.0.1.0/24"
}
resource "hcloud_network_subnet" "subnet" {
network_id = hcloud_network.network.id
type = "cloud"
network_zone = "eu-central"
ip_range = "10.0.1.0/24"
}