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.
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, 1 month agoravi135
Most Recent 8 months, 2 weeks agoNashP
8 months, 3 weeks agoBere
9 months, 1 week agocamps
1 year, 6 months agoRVivek
2 years agoPinky0289
2 years, 1 month agofar12
2 years, 1 month agoshopkitty
2 years, 1 month agokeiffo2
2 years, 1 month agoBurakko
2 years, 1 month ago