Which argument is required when declaring a Terraform output?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which argument is required when declaring a Terraform output?

Explanation:
The thing being tested is what you must include to actually expose something from a module. When you declare an output, Terraform needs to know what data to return, and that comes from the value expression. That value is required because it defines the content of the output. Without it, there’s nothing to output and Terraform will error. The other attributes—description and sensitive—are optional, used for documentation or hiding the value in CLI output, and there are additional optional attributes like type, but they aren’t required. In practice, you’d write something like: output "example" { value = aws_instance.web.public_ip } and you could add a description or mark it sensitive if needed.

The thing being tested is what you must include to actually expose something from a module. When you declare an output, Terraform needs to know what data to return, and that comes from the value expression. That value is required because it defines the content of the output. Without it, there’s nothing to output and Terraform will error. The other attributes—description and sensitive—are optional, used for documentation or hiding the value in CLI output, and there are additional optional attributes like type, but they aren’t required. In practice, you’d write something like: output "example" { value = aws_instance.web.public_ip } and you could add a description or mark it sensitive if needed.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy