finish loop through env variables to get the secret DOC : https://stackoverflow.com/questions/69945533/creating-a-dynamic-secret-variable-block-within-terraform-for-cloud-run
This commit is contained in:
@@ -20,7 +20,7 @@ variable "kubernetes" {
|
||||
mount_path = string
|
||||
})))
|
||||
environment = optional(map(object({
|
||||
name = string
|
||||
name = optional(string)
|
||||
value = optional(string)
|
||||
value_from = optional(object({
|
||||
secret_key_ref = object({
|
||||
@@ -197,7 +197,8 @@ resource "kubernetes_deployment_v1" "automatic" {
|
||||
dynamic "env" {
|
||||
for_each = each.value.environment != null ? each.value.environment : {}
|
||||
content {
|
||||
name = env.key
|
||||
name = env.key
|
||||
value = env.value.value != null ? env.value.value : null
|
||||
dynamic "value_from" {
|
||||
for_each = env.value.value_from != null ? env.value.value_from : {}
|
||||
content {
|
||||
@@ -211,10 +212,6 @@ resource "kubernetes_deployment_v1" "automatic" {
|
||||
}
|
||||
}
|
||||
|
||||
# value = env.value
|
||||
# value_from = {
|
||||
# secret_key_ref = {
|
||||
# name = test } }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ kubernetes = {
|
||||
# environment_variables = { PORT = 80, test = 22 }
|
||||
environment = {
|
||||
MY_VAR = {
|
||||
name = "MY_VAR"
|
||||
name = "MY_VARS"
|
||||
value_from = {
|
||||
secret_key_ref = {
|
||||
name = "my_secret"
|
||||
@@ -42,6 +42,10 @@ kubernetes = {
|
||||
}
|
||||
}
|
||||
}
|
||||
DEUX_VAR = {
|
||||
name = "var-deux"
|
||||
value = "valeur"
|
||||
}
|
||||
}
|
||||
pvc = {
|
||||
onitamadeux = {
|
||||
|
||||
Reference in New Issue
Block a user