【问题标题】:what is the error in the security group line?安全组行中的错误是什么?
【发布时间】:2020-12-28 22:35:33
【问题描述】:

security_groups = ["{aws_security_group.allow_ssh.id}"]

获取特定行的以下错误

aws_instance.jenkinsec2:正在创建...

错误:启动实例时出错,安全组 ID 和名称可能不匹配。在此处查看 AWS 实例文档:https://terraform.io/docs/providers/aws/r/instance.html

    AWS Error: InvalidParameterValue: Value () for parameter groupId is invalid. The value cannot be empty
    status code: 400, request id: d2184bbd-e63d-49d3-a77b-3997b140ffe0

【问题讨论】:

  • 您能否编辑您的问题以包含您尝试过的内容的minimal reproducible example,然后在代码块中格式化尽可能多的上下文来显示错误?此外,您不应该使用 security_groups 参数,除非您正在运行您链接的 aws_instance 资源文档中提到的 EC2 Classic(非 VPC)帐户。

标签: amazon-web-services terraform


【解决方案1】:

通常在 0.11 中会如下:

security_groups = ["${aws_security_group.allow_ssh.id}"]

或0.12及以上版本:

security_groups = [aws_security_group.allow_ssh.id]

【讨论】:

    【解决方案2】:

    我也有同样的问题。我已经解决了更改名称的 id 问题。像这样:

    security_groups = [ aws_security_group.<SG_NAME>.name ]
    

    【讨论】:

      猜你喜欢
      • 2019-01-08
      • 1970-01-01
      • 2019-09-03
      • 2019-05-06
      • 2023-03-28
      • 2013-11-25
      • 2020-05-20
      相关资源
      最近更新 更多