【发布时间】:2020-10-09 02:42:58
【问题描述】:
在代码 .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.
我应该怎么做才能修复这个错误?
【问题讨论】:
-
非布尔到布尔的隐式转换是旧版本 Terraform 中不受支持的半意外功能。您需要使用明确的布尔类型,例如
true或false。
标签: amazon-web-services boolean syntax-error terraform terraform-provider-aws