lavenderguitar
3 years ago
4 changed files with 95 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||
resource "linode_lke_cluster" "cluster1" { |
|||
k8s_version = var.k8s_version |
|||
label = var.label |
|||
region = var.region |
|||
tags = var.tags |
|||
|
|||
dynamic "pool" { |
|||
for_each = var.pools |
|||
content { |
|||
type = pool.value["type"] |
|||
count = pool.value["count"] |
|||
} |
|||
} |
|||
} |
|||
|
|||
output "kubeconfig" { |
|||
description = "Linode kubeconfig." |
|||
value = base64decode(linode_lke_cluster.cluster1.kubeconfig) |
|||
sensitive = true |
|||
} |
|||
|
|||
resource "local_file" "kubeconfig" { |
|||
content = base64decode(linode_lke_cluster.cluster1.kubeconfig) |
|||
filename = "../.kube-config" |
|||
file_permission = "0400" |
|||
} |
|||
|
|||
output "api_endpoints" { |
|||
value = linode_lke_cluster.cluster1.api_endpoints |
|||
} |
|||
|
|||
output "status" { |
|||
value = linode_lke_cluster.cluster1.status |
|||
} |
@ -0,0 +1,14 @@ |
|||
terraform { |
|||
required_providers { |
|||
linode = { |
|||
source = "linode/linode" |
|||
version = "1.16.0" |
|||
} |
|||
} |
|||
} |
|||
|
|||
provider "linode" { |
|||
token = var.token |
|||
} |
|||
|
|||
provider "local" {} |
@ -0,0 +1,9 @@ |
|||
label = "production-lke-cluster" |
|||
k8s_version = "1.21" |
|||
region = "us-central" |
|||
pools = [ |
|||
{ |
|||
type : "g6-standard-1" |
|||
count : 1 |
|||
} |
|||
] |
@ -0,0 +1,38 @@ |
|||
variable "token" { |
|||
description = "Your Linode API Personal Access Token. (required)" |
|||
} |
|||
|
|||
variable "k8s_version" { |
|||
description = "The Kubernetes version to use for this cluster. (required)" |
|||
default = "1.17" |
|||
} |
|||
|
|||
variable "label" { |
|||
description = "The unique label to assign to this cluster. (required)" |
|||
default = "default-lke-cluster" |
|||
} |
|||
|
|||
variable "region" { |
|||
description = "The region where your cluster will be located. (required)" |
|||
default = "us-east" |
|||
} |
|||
|
|||
variable "tags" { |
|||
description = "Tags to apply to your cluster for organizational purposes. (optional)" |
|||
type = list(string) |
|||
default = ["testing"] |
|||
} |
|||
|
|||
variable "pools" { |
|||
description = "The Node Pool specifications for the Kubernetes cluster. (required)" |
|||
type = list(object({ |
|||
type = string |
|||
count = number |
|||
})) |
|||
default = [ |
|||
{ |
|||
type = "g6-standard-4" |
|||
count = 3 |
|||
}, |
|||
] |
|||
} |
Loading…
Reference in new issue