Skip to content

Commit f952b21

Browse files
committed
chor: better environment variable format
1 parent 69c159a commit f952b21

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ locals {
3636
dockerLabels = jsonencode(var.dockerLabels)
3737
dockerSecurityOptions = jsonencode(var.dockerSecurityOptions)
3838
entryPoint = jsonencode(var.entryPoint)
39-
environment = jsonencode(var.environment)
4039
extraHosts = jsonencode(var.extraHosts)
4140

41+
environment = jsonencode(var.environment != {} ? [for k, v in var.environment : { "name" : k, "value" : v }] : [])
4242
healthCheck = replace(jsonencode(var.healthCheck), local.classes["digit"], "$1")
4343

4444
links = jsonencode(var.links)

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ variable "entryPoint" {
4949
}
5050

5151
variable "environment" {
52-
default = []
52+
default = {}
5353
description = "The environment variables to pass to a container"
54-
type = list(map(string))
54+
type = map(string)
5555
}
5656

5757
variable "essential" {

0 commit comments

Comments
 (0)