Amazon web services 计数=真。在terraform 11中工作,但不在terrafom 12中工作

Amazon web services 计数=真。在terraform 11中工作,但不在terrafom 12中工作,amazon-web-services,terraform,Amazon Web Services,Terraform,我正在升级到terraform 12并面临一些问题。我们有一个自动缩放模块(非根),它调用中央存储库(根)中的另一个模块。 所以这个模块, module "cef_fleet" { source = "git::ssh://git@github.com/asg-repo.git?ref=terraform12" instance_type = va

我正在升级到terraform 12并面临一些问题。我们有一个自动缩放模块(非根),它调用中央存储库(根)中的另一个模块。 所以这个模块,

     module "cef_fleet" {
           source  = "git::ssh://git@github.com/asg-repo.git?ref=terraform12"
           instance_type                            = var.instance_type
           ami                                      = var.ami
           etc ...
调用存储库“asg repo”,在这里一些资源具有计数功能,例如

resource "aws_autoscaling_schedule" "schedule_stop" {
    count = var.create_resource * var.auto_stop
中央存储库中的这两个变量都设置为“true”。这适用于terraform 11,但当我升级到12时,我现在得到了错误

    var.create_resource is true
      Unsuitable value for left operand: number required.
解决这个问题的方法是,简单地说,用1替换真值吗?或者应该是这样的

count = signum(count = var.create_resource * var.auto_start) - where both are also 1?

使用三元运算符:

count = var.create_resource && var.auto_start ? 1 : 0

谢谢@Dan,不幸的是,这不起作用。错误仍然存在,但现在它确实看到了这个三元运算符。这就是错误——count=var.create\u resource*var.with\u internal\u elb?1 : 0. var.create\u资源为true。左操作数的值不合适:需要数字。-在本例中,这两个值都是trueTry,而是使用&&运算符。已编辑答案以与此匹配。