BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

HashiCorp Exam VA-002-P Topic 8 Question 85 Discussion

Actual exam question for HashiCorp's VA-002-P exam
Question #: 85
Topic #: 8
[All VA-002-P Questions]

What is the result of the following terraform function call?

lookup({a="hello", b="goodbye"}, "c", "what?")

Show Suggested Answer Hide Answer
Suggested Answer: C

lookup retrieves the value of a single element from a map, given its key. If the given key does not exist, the given default value is returned instead. In this case, the function call is searching for the key 'c'. But since there is no key 'c', the default vault 'what?' is returned.

https://www.terraform.io/docs/configuration/functions/lookup.html


Contribute your Thoughts:

Isidra
6 months ago
I bet the Terraform community has a running joke about the `lookup()` function. Something like, 'Why did the `lookup()` function cross the road? To find the key it was looking for!'
upvoted 0 times
Carisa
4 months ago
B) hello
upvoted 0 times
...
Celestina
4 months ago
Haha, that's a good one!
upvoted 0 times
...
Stefan
4 months ago
A) goodbye
upvoted 0 times
...
Albina
5 months ago
B) hello
upvoted 0 times
...
Latrice
5 months ago
Haha, that's a good one!
upvoted 0 times
...
Arletta
5 months ago
C) what?
upvoted 0 times
...
Lavelle
5 months ago
A) goodbye
upvoted 0 times
...
Annmarie
5 months ago
B) hello
upvoted 0 times
...
Freida
5 months ago
A) goodbye
upvoted 0 times
...
...
Maddie
6 months ago
Ah, the good old `lookup()` function. I'm feeling lucky, so I'll go with D. Maybe the question is trying to trick us, you know?
upvoted 0 times
...
Giovanna
6 months ago
Hmm, I think I'll go with B. The `lookup()` function is supposed to return the value associated with the key, and 'hello' is the value for the key 'a'.
upvoted 0 times
Jovita
5 months ago
I agree with you, I'll go with A) goodbye.
upvoted 0 times
...
Meaghan
5 months ago
I think the answer is A) goodbye.
upvoted 0 times
...
...
Kristofer
6 months ago
C'mon, this is easy! The answer is clearly C. Who doesn't know that the `lookup()` function returns the default value when the key is not found?
upvoted 0 times
Ilene
5 months ago
I think we should go with A) goodbye
upvoted 0 times
...
Annita
5 months ago
I agree with you, it must be C) what?
upvoted 0 times
...
Jerry
5 months ago
I'm going with D) c
upvoted 0 times
...
Teddy
5 months ago
I'm pretty confident it's C) what?
upvoted 0 times
...
Dong
5 months ago
Are you sure? I thought it was B) hello
upvoted 0 times
...
Malcolm
5 months ago
No, it's actually A) goodbye
upvoted 0 times
...
Ashleigh
5 months ago
I think the answer is C) what?
upvoted 0 times
...
Rosio
5 months ago
Yes, it makes sense that 'what?' would be returned as the default value.
upvoted 0 times
...
Susana
5 months ago
I think the answer is C too.
upvoted 0 times
...
...

Save Cancel