Terraform-Associate-004 practice question 33 of 35

Which of the following is not a valid string function in Terraform?

Full set: 360 questions
Answer options
A: chomp
B: join
C: slice Correct answer
D: split
Correct Answer:
C. slice
Explanation

The slice function is not a string function in Terraform; it is a collection function. It is used to extract a contiguous sublist from a given list. The functions chomp, join, and split are all valid built-in functions specifically designed for string manipulation. chomp removes trailing newlines, join concatenates elements of a list into a string with a separator, and split divides a string into a list of strings based on a separator.

Why Incorrect

A. chomp is a valid string function that removes trailing newline characters from a string.
B. join is a valid string function that creates a string by concatenating all the elements of a list with a given separator.
D. split is a valid string function that produces a list of strings by dividing a given string at a given separator.

References

1. HashiCorp Terraform Documentation, slice function: "slice extracts a contiguous sublist from a given list." This page categorizes slice under "Collection Functions."

Source: HashiCorp, Terraform Language Documentation, Functions, slice.

2. HashiCorp Terraform Documentation, chomp function: "chomp removes trailing newline characters from a string." This page categorizes chomp under "String Functions."

Source: HashiCorp, Terraform Language Documentation, Functions, chomp.

3. HashiCorp Terraform Documentation, join function: "The join function produces a string by concatenating all of the elements of a given list of strings with the given separator." This page categorizes join under "String Functions."

Source: HashiCorp, Terraform Language Documentation, Functions, join.

4. HashiCorp Terraform Documentation, split function: "The split function produces a list of strings by splitting a given string at a given separator." This page categorizes split under "String Functions."

Source: HashiCorp, Terraform Language Documentation, Functions, split.

Scroll to Top