我正在尝试从我的 terragrunt.hcl 输入中传递一个列表,其中包含容器的环境变量。但我无法让它工作。
terragrunt.hcl:
inputs = {
containers_env = {
"ENV_TEST" = "testing"
"ENV_TEST_2" = "testing2"
}
}
主文件:
resource "kubernetes_cron_job" "cronjob" {
metadata {
name = var.metadata_name
namespace = var.metadata_namespace
}
spec {
schedule = var.spec_schedule
concurrency_policy = var.spec_concurrencyPolicy
failed_jobs_history_limit = var.spec_failedJobsHistoryLimit
successful_jobs_history_limit = var.spec_successfulJobsHistoryLimit
job_template {
metadata {}
spec {
template {
metadata {}
spec {
restart_policy = var.template_spec_restartPolicy
termination_grace_period_seconds = var.template_spec_terminationGracePeriodSeconds
container {
name = var.containers_name
image = var.containers_image
image_pull_policy = var.containers_imagePullPolicy
command = var.containers_command
env = var.containers_env
}
}
}
}
}
}
}
变量.tf:
variable "containers_env" {
description = ""
type = map(string)
}
我收到错误:
Error: Unsupported argument
on main.tf line 41, in resource "kubernetes_cron_job" "cronjob":
41: env = var.containers_env
An argument named "env" is not expected here. Did you mean to define a block
of type "env"?
Terraform:v0.12.13 Terragrunt:v0.21.5