Terraform 12无法部署beantalk健康状况报告设置

时间:2020-08-05 00:53:03

标签: amazon-web-services amazon-elastic-beanstalk terraform

我在Terraform部署中包括了healthreportreport,但是出现此错误

错误

Error: Unsupported argument

  on ../mods/environment/environment.tf line 210, in resource "aws_elastic_beanstalk_environment" "environment":
 210:   setting = {

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

我正在模板文件夹上使用此json文件

hc.tpl文件=位于../mods/environment/hc文件夹中

{
  "CloudWatchMetrics": {
    "Environment": {
      "ApplicationRequests2xx": 60,
      "ApplicationRequests5xx": 60,
      "ApplicationRequests4xx": 60
  },
  "Instance": {
      "ApplicationRequestsTotal": 60
    }
  },
  "Version": 1
}

我的Terraform代码部署(我删除了一些代码块以减少阅读量)

data "template_file" "hc" {
  template = "${file("../mods/environment/hc/hc.tpl")}"
}

resource "aws_elastic_beanstalk_environment" "pogi" {
  name                    = "pogi-poc"
  application             = "pogi-poc"
  solution_stack_name     = "64bit Amazon Linux 2018.03 v2.9.8 running PHP 7.0"
  setting {
    namespace = "aws:ec2:vpc"
    name      = "VPCId"
    value     = "vpc-12345"
  }
  setting {
    namespace = "aws:ec2:vpc"
    name = "ELBScheme"
    value = "internal"
  }
  setting {
    namespace = "aws:ec2:vpc"
    name = "AssociatePublicIpAddress"
    value = "false"
  }
  setting = {
    namespace = "aws:elasticbeanstalk:healthreporting:system"
    name = "ConfigDocument"
    value = data.template_file.hc.rendered
  }
}

我也使用了某人尝试过的approach,但是我收到了同样的错误消息

1 个答案:

答案 0 :(得分:1)

您有=

  setting = {
    namespace = "aws:elasticbeanstalk:healthreporting:system"
    name = "ConfigDocument"
    value = data.template_file.hc.rendered
  }

应该是:

  setting {
    namespace = "aws:elasticbeanstalk:healthreporting:system"
    name = "ConfigDocument"
    value = data.template_file.hc.rendered
  }