terraform error: unsupported argument in module in tf plan

terraform error: unsupported argument in module in tf plan

当我在版本 12.24 中 运行 terraform plan 时,我收到错误:不支持的参数。

Error: Unsupported argument

  on .terraform/modules/admin_portal.cf_portal/modules/aws-terraform-cloudfront_s3_origin/main.tf line 60, in resource "aws_cloudfront_distribution" "cf_distribution":
  60:   logging_config = local.bucket_logging[local.bucket_logging_config]

An argument named "logging_config" is not expected here. Did you mean to
define a block of type "logging_config"?

tf 文件中的代码:

  logging_config = local.bucket_logging[local.bucket_logging_config]

我该如何解决?

variable "logging" {
  default = local.bucket_logging[local.bucket_logging_config]
}

之后,您可以在任何语句中将其与 var.logging 一起使用

但是我推荐你使用本地的。当您需要在语句中而不是放入 var.