Linux command
terraform-output 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show all outputs
terraform output
Show specific output
terraform output [name]
Output as JSON
terraform output -json
Get raw value
terraform output -raw [name]
说明
terraform output reads output values from the Terraform state file. It displays values defined in `output` blocks of the root module. Useful for scripting, passing values between configurations, and extracting infrastructure details like IP addresses, URLs, or resource IDs. Use -raw to get a bare string suitable for shell scripting (no quotes or formatting). Use -json to get machine-readable output including type information. When called without a name, all outputs are displayed.
参数
- -json
- Output as JSON.
- -raw
- Output raw string value.
- -state _path_
- Read from state file.
- -no-color
- Disable color output.
FAQ
What is the terraform-output command used for?
terraform output reads output values from the Terraform state file. It displays values defined in `output` blocks of the root module. Useful for scripting, passing values between configurations, and extracting infrastructure details like IP addresses, URLs, or resource IDs. Use -raw to get a bare string suitable for shell scripting (no quotes or formatting). Use -json to get machine-readable output including type information. When called without a name, all outputs are displayed.
How do I run a basic terraform-output example?
Run `terraform output` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -json do in terraform-output?
Output as JSON.