【问题标题】:terraform error: unsupported argument in module in tf planterraform 错误:tf 计划中的模块中不支持的参数
【发布时间】:2021-01-16 15:35:23
【问题描述】:

当我在版本 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]

我该如何解决?

【问题讨论】:

  • 你能在logging_config出现的地方显示完整的代码吗?

标签: amazon-web-services syntax-error terraform terraform-provider-aws terraform-modules


【解决方案1】:
variable "logging" {
  default = local.bucket_logging[local.bucket_logging_config]
}

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

但我建议你使用本地。当您需要在语句中而不是放入 var 时。

【讨论】:

    猜你喜欢
    • 2021-01-30
    • 2021-06-27
    • 2021-01-16
    • 1970-01-01
    • 2021-02-18
    • 2021-01-09
    • 2021-01-20
    • 2021-11-11
    • 1970-01-01
    相关资源
    最近更新 更多