amazon-web-services - Terraform 错误:运行 terraform 计划时条件类型不正确
问题描述
在代码 .tf 文件中:
resource "aws_vpc_peering_connection" "this_1" {
count = var.create_peering_1 ? 1 : 0
peer_owner_id = var.peer_account_id_1
peer_vpc_id = var.vpc_peer_id_1
vpc_id = module.vpc.vpc_id
auto_accept = var.auto_accept_peering_1
}
variables.tf 中的变量:
variable "create_peering_1" {
description = "Create peering connection, 0 to not create"
default = 0
}
我得到的错误:
Error: Incorrect condition type
on peering_1.tf line 6, in resource "aws_vpc_peering_connection" "this_1":
6: count = var.create_peering_1 ? 1 : 0
|----------------
| var.create_peering_1 is 0
The condition expression must be of type bool.
我应该怎么做才能修复这个错误?
解决方案
0
用作_false
variable "create_peering_1" {
description = "Create peering connection, false to not create"
default = false
type = bool
}
推荐阅读
- python - 用于大型数据集的 OpenCV、OpenBR 或 OpenFace?
- javascript - 在javascript中获取当前会话值不起作用
- javascript - Table inside a dynamic table accordion on clicking particular row
- c - 如何使opengl文本可见/更改颜色?
- php - 如何在自己的网站上显示谷歌分析仪表板
- php - 登录虚拟键盘库
- swift - Swift - UICollectionView dynamic height
- powershell - Most of time facing Access denied issue for Exchange server
- liferay - liferay中的自动增量值
- blockchain - Composer Rest Server 启动后浏览器中的连接超时