Skip to content

Commit

Permalink
Add support for LB in upcloud private zone
Browse files Browse the repository at this point in the history
  • Loading branch information
davidumea committed May 31, 2024
1 parent baf4842 commit 0736580
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
8 changes: 7 additions & 1 deletion contrib/terraform/upcloud/cluster-settings.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# See: https://developers.upcloud.com/1.3/5-zones/
zone = "fi-hel1"
zone = "fi-hel1"
private_cloud = false

# Only used if private_cloud = true, public zone equivalent
# For example use finnish public zone for finnish private zone
public_zone = "fi-hel2"

username = "ubuntu"

# Prefix to use for all resources to separate them from other resources
Expand Down
4 changes: 3 additions & 1 deletion contrib/terraform/upcloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ module "kubernetes" {
source = "./modules/kubernetes-cluster"

prefix = var.prefix
zone = var.zone
zone = var.zone
private_cloud = var.private_cloud
public_zone = var.public_zone

template_name = var.template_name
username = var.username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ resource "upcloud_loadbalancer" "lb" {
configured_status = "started"
name = "${local.resource-prefix}lb"
plan = var.loadbalancer_plan
zone = var.zone
zone = var.private_cloud ? var.public_zone : var.zone
network = upcloud_network.private.id
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ variable "zone" {
type = string
}

variable "private_cloud" {
type = bool
}

variable "public_zone" {
type = string
}

variable "template_name" {}

variable "username" {}
Expand Down
9 changes: 9 additions & 0 deletions contrib/terraform/upcloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ variable "zone" {
description = "The zone where to run the cluster"
}

variable "private_cloud" {
description = "Whether the environment is in the private cloud region"
default = false
}

variable "public_zone" {
description = "The public zone equivalent if the cluster is running in a private cloud zone"
}

variable "template_name" {
description = "Block describing the preconfigured operating system"
}
Expand Down

0 comments on commit 0736580

Please sign in to comment.