Browse Source

Add support for LB in upcloud private zone (#11260)

pull/11414/head
David 3 months ago
committed by GitHub
parent
commit
2799f11475
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 4 deletions
  1. 8
      contrib/terraform/upcloud/cluster-settings.tfvars
  2. 6
      contrib/terraform/upcloud/main.tf
  3. 2
      contrib/terraform/upcloud/modules/kubernetes-cluster/main.tf
  4. 8
      contrib/terraform/upcloud/modules/kubernetes-cluster/variables.tf
  5. 9
      contrib/terraform/upcloud/variables.tf

8
contrib/terraform/upcloud/cluster-settings.tfvars

@ -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

6
contrib/terraform/upcloud/main.tf

@ -11,8 +11,10 @@ provider "upcloud" {
module "kubernetes" {
source = "./modules/kubernetes-cluster"
prefix = var.prefix
zone = var.zone
prefix = var.prefix
zone = var.zone
private_cloud = var.private_cloud
public_zone = var.public_zone
template_name = var.template_name
username = var.username

2
contrib/terraform/upcloud/modules/kubernetes-cluster/main.tf

@ -515,7 +515,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
networks {
name = "Private-Net"
type = "private"

8
contrib/terraform/upcloud/modules/kubernetes-cluster/variables.tf

@ -6,6 +6,14 @@ variable "zone" {
type = string
}
variable "private_cloud" {
type = bool
}
variable "public_zone" {
type = string
}
variable "template_name" {}
variable "username" {}

9
contrib/terraform/upcloud/variables.tf

@ -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"
}

Loading…
Cancel
Save