【问题标题】:Where does "aws_eip" resource in terraform file (.tf) gets the value referring "id" attribute in "aws_instance" resource?terraform 文件 (.tf) 中的“aws_eip”资源在哪里获取引用“aws_instance”资源中“id”属性的值?
【发布时间】:2018-11-06 06:16:49
【问题描述】:

在本页https://www.terraform.io/intro/getting-started/dependencies.html

aws_instance.example.id 的值是什么,因为我没有看到实例资源的名为 id 的属性 (https://www.terraform.io/docs/providers/aws/d/instance.html)

【问题讨论】:

    标签: terraform terraform-provider-aws


    【解决方案1】:

    第二个链接指向有关数据源的文档。

    在页面https://www.terraform.io/intro/getting-started/dependencies.html中,"${aws_instance.example.id}"指的是资源,而不是数据源(数据源前面有data.

    以下是您要查找的有关 aws_instance 的文档: https://www.terraform.io/docs/providers/aws/r/instance.html#id

    在 Terraform 中区分 resourcesdata sources 非常重要;)

    【讨论】:

    • 我发现了我的错字。我看错了。谢谢:)。
    • 嗨!如果此答案解决了问题,请将其标记为正确
    【解决方案2】:

    从您链接的页面:

    id 设置为找到的实例的 ID。

    除了列出的属性

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-09
      • 2021-12-11
      • 2012-08-18
      • 1970-01-01
      • 2020-02-21
      • 2013-04-28
      • 1970-01-01
      • 2018-07-09
      相关资源
      最近更新 更多