在代码.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.我应该怎么做才能修复这个错误?
发布于 2020-10-09 01:49:32
variable "create_peering_1" {
type = bool
default = true布尔值必须为真或假。
发布于 2020-10-09 02:42:04
将0用作false令人困惑
variable "create_peering_1" {
description = "Create peering connection, false to not create"
default = false
type = bool
}https://stackoverflow.com/questions/64267986
复制相似问题