fix terraform main

This commit is contained in:
jakubknczny 2021-12-01 12:23:40 +01:00
parent 3cd6534e06
commit 0e2636767b

16
main.tf
View File

@ -1,6 +1,6 @@
terraform {
required_providers {
hc = {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.32.1"
}
@ -11,11 +11,11 @@ variable "token" {
type = string
}
provider "hc" {
provider "hcloud" {
token = var.token
}
resource "hc_sv" "ubuntu" {
resource "hcloud_sv" "ubuntu" {
name = "jk-test1"
image = "ubuntu-20.04"
server_type = "cpx11"
@ -31,24 +31,24 @@ resource "hc_sv" "ubuntu" {
]
}
resource "hc_sv" "mysql" {
resource "hcloud_sv" "mysql" {
name = "jk-test2"
image = "ubuntu-20.04"
server_type = "cpx11"
user_data = file("cloud-init-db")
network {
network_id = hc_network.network.id
network_id = hcloud_network.network.id
}
}
resource "hc_network" "network" {
resource "hcloud_network" "network" {
name = "jk-test3"
ip_range = "10.0.1.0/24"
}
resource "hc_network_subnet" "subnet" {
network_id = hc_network.network.id
resource "hcloud_network_subnet" "subnet" {
network_id = hcloud_network.network.id
type = "cloud"
network_zone = "eu-central"
ip_range = "10.0.1.0/24"