将地图变量作为字符串传递到Terraform中的CodePipeline Environment Variables部分
我正在尝试通过下面的图形变量:
variables "egress_ports" {
type = map(any)
default = {
"from_port" = 8443
"to_port" = 8443
}
description = "e-gress required by pipeline"
}
以下codepipeline的环境变量部分
<stages>
{
EnvironmentVariables = jsonencode(var.egress_ports)
}
在我尝试这样的情况下, 。 有人可以帮助如何传递它。
这是我正在尝试的环境变量部分::
EnvironmentVariables = templatefile("./pre-req.tmpl", {pipeline_name = var.pipeline_name, app_id = var.app_id, **egress_ports = jsonencode(var.egress_ports)** })
如果没有egress_ports变量,一切正常,因为那是唯一的映射类型。请帮忙。
谢谢
I am trying to pass a map variable per below :
variables "egress_ports" {
type = map(any)
default = {
"from_port" = 8443
"to_port" = 8443
}
description = "e-gress required by pipeline"
}
into Environment variable section of codepipeline in terraform per below
<stages>
{
EnvironmentVariables = jsonencode(var.egress_ports)
}
When i try like this.. getting the error that EnvironmentVariable section requires json array of strings.
Could someone please help how to pass it in.
Here is the Environment Variable section i am trying ::
EnvironmentVariables = templatefile("./pre-req.tmpl", {pipeline_name = var.pipeline_name, app_id = var.app_id, **egress_ports = jsonencode(var.egress_ports)** })
Everything works fine without egress_ports variable, as that is the only one which is map type. please help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要转换Terraform变量输入以遵循此格式,然后将其传递到Environment Variables中。
you may need to transform your terraform variable input to follow this format and then pass it into EnvironmentVariables.