Rationale for Correct Answer (B):The file() function reads a file from disk and returns its content as a string. This is commonly used for public keys (.pub files).
Analysis of Incorrect Options:
A. fileset(): Returns a set of filenames matching a pattern, not file contents.
C. filebase64(): Reads file and returns Base64 encoded string — unnecessary for .pub.
D. templatefile(): Used for rendering templates with variables, not raw file contents.
Key Concept:Terraform’s file() function is used for injecting file content directly.