首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >terraform变量声明错误

terraform变量声明错误
EN

Stack Overflow用户
提问于 2019-11-07 07:44:57
回答 2查看 96关注 0票数 0

我在terraform 0.11.14上,我有一个aws_cloudformation_stack资源,如下:

代码语言:javascript
运行
复制
resource "aws_cloudformation_stack" "ingress_sg" {
  name = "bastion-${var.accountName}-ingressIntuitIPs"

  lifecycle {
    prevent_destroy = true
  }

  parameters {
    VpcId = "${var.default_vpc_id}"
    Port = 22
    Name = "bastion-${var.accountName}-ingressIntuitIPs"
    GroupName = "true"
  }
  }```

when i run terraform, its throwing this error:

```Error: module.swimlane.module.bastion.aws_cloudformation_stack.ingress_sg: 1 error occurred:
代码语言:javascript
运行
复制
* module.swimlane.module.bastion.aws_cloudformation_stack.ingress_sg: invalid variable syntax: "VpcId". Did you mean 'var.VpcId'? If this is part of inline `template` parameter

,然后你必须用两个美元符号来转义插值。为

示例:${a}变为$${a}。

代码语言:javascript
运行
复制

任何帮助都是非常感谢的。提前谢谢。

EN

Stack Overflow用户

发布于 2019-11-07 08:07:01

错误消息确切地说明了您需要执行的操作:

代码语言:javascript
运行
复制
"you must escape the interpolation with two dollar signs. For
example: ${a} becomes $${a}."

意味着

代码语言:javascript
运行
复制
VpcId = "${var.default_vpc_id}" 

变成了

代码语言:javascript
运行
复制
VpcId = "$${var.default_vpc_id}"
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58739995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档