From 22510d37e36fd9dc2db96972ceacbc8399da2a7d Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 8 Sep 2022 13:43:44 +0200 Subject: [PATCH] feat: use default server vars --- main.tf | 6 +++--- variables.tf | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index be86e01..ae49b5f 100644 --- a/main.tf +++ b/main.tf @@ -49,9 +49,9 @@ resource "hcloud_server" "server" { depends_on = [hcloud_ssh_key.key] name = each.value.name - server_type = try(each.value.type, "cx11") - image = try(each.value.image, "rocky-9") - datacenter = try(each.value.datacenter, "fsn1-dc14") + server_type = try(each.value.type, var.server_type) + image = try(each.value.image, var.server_image) + datacenter = try(each.value.datacenter, var.server_datacenter) ssh_keys = var.server_keys backups = try(each.value.backups, true) keep_disk = try(each.value.keep_disk, false) diff --git a/variables.tf b/variables.tf index ac8104e..861ce2d 100644 --- a/variables.tf +++ b/variables.tf @@ -49,3 +49,18 @@ variable "ssh_keys" { variable "server_dns_zone" { type = string } + +variable "server_type" { + type = string + default = "cx11" +} + +variable "server_image" { + type = string + default = "rocky-9" +} + +variable "server_datacenter" { + type = string + default = "fsn1-dc14" +}