feature: variabilize replicas number for deployment
This commit is contained in:
parent
3c62528dd4
commit
ce557fe8f2
6
input.tf
6
input.tf
@ -53,3 +53,9 @@ variable "volumes" {
|
||||
)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "replicas" {
|
||||
type = number
|
||||
default = 1
|
||||
description = "number of replicas for the application's pod"
|
||||
}
|
2
main.tf
2
main.tf
@ -43,7 +43,7 @@ resource "kubernetes_deployment_v1" "deployment" {
|
||||
}
|
||||
}
|
||||
spec {
|
||||
replicas = "1"
|
||||
replicas = var.replicas
|
||||
selector {
|
||||
match_labels = {
|
||||
"app.kubernetes.io/name" = local.label_name
|
||||
|
@ -7,6 +7,7 @@ run "terraform-plan" {
|
||||
image = {
|
||||
name = "container.localdomain/test-image"
|
||||
}
|
||||
replicas = 2
|
||||
}
|
||||
|
||||
assert {
|
||||
@ -15,7 +16,7 @@ run "terraform-plan" {
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = kubernetes_deployment_v1.deployment.spec[0].replicas == "1"
|
||||
condition = kubernetes_deployment_v1.deployment.spec[0].replicas == "2"
|
||||
error_message = "invalid number of replicas"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user