0
0
Terraformcloud~10 mins

Tuple type definition in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a tuple variable with two string elements.

Terraform
variable "example" {
  type = tuple[[1]]
}
Drag options to blanks, or click blank then click option'
Amap(string)
Bstring, string
Clist(string)
Dstring
Attempts:
3 left
💡 Hint
Common Mistakes
Using list(string) instead of tuple for fixed-length heterogeneous types.
Not separating types with commas inside the tuple.
Using map instead of tuple.
2fill in blank
medium

Complete the code to define a tuple variable with a string and a number.

Terraform
variable "mixed" {
  type = tuple[[1]]
}
Drag options to blanks, or click blank then click option'
Astring, number
Bstring number
Clist(string, number)
Dtuple(string, number)
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces instead of commas between types.
Using parentheses instead of square brackets.
Using list instead of tuple.
3fill in blank
hard

Fix the error in the tuple type definition to accept a string and a boolean.

Terraform
variable "settings" {
  type = tuple[[1]]
}
Drag options to blanks, or click blank then click option'
Astring, bool
Bstring bool
Clist(string, bool)
Dtuple(string, bool)
Attempts:
3 left
💡 Hint
Common Mistakes
Missing commas between types.
Using parentheses instead of square brackets.
Using list instead of tuple.
4fill in blank
hard

Fill both blanks to define a tuple with a number and a list of strings.

Terraform
variable "complex" {
  type = tuple[[1], [2]]
}
Drag options to blanks, or click blank then click option'
Anumber
Blist(string)
Cstring
Dmap(string)
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of number for the first element.
Using map instead of list for the second element.
Not separating types with commas.
5fill in blank
hard

Fill all three blanks to define a tuple with a string, a bool, and a map of strings.

Terraform
variable "full" {
  type = tuple[[1], [2], [3]]
}
Drag options to blanks, or click blank then click option'
Astring
Bbool
Cmap(string)
Dlist(string)
Attempts:
3 left
💡 Hint
Common Mistakes
Using list(string) instead of map(string) for the third element.
Mixing up bool and string types.
Not using commas between types.