我想提取来自 的数据terraform state show。根据文档我们应该使用terraform show -json. https://www.terraform.io/docs/cli/commands/state/show.html
terraform state show 的输出旨在供人类消费,而不是程序消费。要提取状态数据以在其他软件中使用,请使用 terraform show -json 并使用记录的结构解码结果。
不知道如何terrafrom state show结合使用terrafrom show
$ terraform state show 'packet_device.worker'
# packet_device.worker:
resource "packet_device" "worker" {
billing_cycle = "hourly"
created = "2015-12-17T00:06:56Z"
facility = "ewr1"
hostname = "prod-xyz01"
id = "6015bg2b-b8c4-4925-aad2-f0671d5d3b13"
locked = false
}
Run Code Online (Sandbox Code Playgroud) terraform ×1