簡體   English   中英

如何在 Terraform 模塊中添加數據資源

[英]How to add a data resource within a Terraform module

我有一個數據資源和模塊

 data "aws_instances" "XXX" { instance_tags = { Name = "XXXX" } instance_state_names = ["running", "stopped"] } module "XXXX" { count = length(data.aws_instances.ids) source = "./alarms" id = data.aws_instances.ids[count.index] }

如何在模塊內移動數據塊

為什么要這么做?

數據源是一種資源。

如果要使用數據源之外的某些數據,請使用語法:data.aws_instances.xxxxx

請參閱terraform 文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM