You're writing a Terraform configuration that needs to read input from a local file called id_rsa.pub. Which built-in Terraform function can you use to import the file's contents as a string?
D. file("id_rsa.pub")
Explanation:To read the contents of a local file as a string in Terraform, you can use the file function. The correct syntax is:
variable "public_key" {
type = string
default = file("id_rsa.pub")
}
This will read the contents of the "id_rsa.pub" file and assign it to the variable "public_key" as a string.
D. file("id_rsa.pub").
The file function is a built-in Terraform function that can be used to read the contents of a local file and return the contents as a string. The file function takes a single argument, which is the path to the file to read.
the correct answer is D , explain :
- file reads the contents of a file at the given path and returns them as a string.
- filebase64 also reads the contents of a given file, but returns the raw bytes in that file Base64-encoded.
-templatefile renders using a file from disk as a template.
"file reads the contents of a file at the given path and returns them as a string."
file(path)
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Uma10
Highly Voted 2 years, 2 months agoravi135
Most Recent 9 months, 2 weeks agoNashP
9 months, 3 weeks agoBere
10 months, 1 week agocamps
1 year, 7 months agoRVivek
2 years, 1 month agoPinky0289
2 years, 2 months agofar12
2 years, 2 months agoshopkitty
2 years, 2 months agokeiffo2
2 years, 2 months agoBurakko
2 years, 2 months ago