A company managing public parks is using Terraform modules for their web servers.

The following is a snippet from the module in the web_server folder:

variable "count_of_containers" {
  type = number

variable "port_number" {
  type = number

resource "docker_image" "park_web_image" {
  name = "parkweb:latest"

resource "docker_container" "park_web_server" {
  count = var.count_of_containers
  image = docker_image.park_web_image.latest
  name = "container-${count.index}"
  ports {
    internal = var.port_number
    external = var.port_number

How can another module in the same project use it?

(Select all acceptable answers.)

The module using web_server should set its source property to the path of the web_server module.
The web_server module will expose the name of all containers as an output variable which is usable by modules importing it.
The module using the web_server can set the count variable directly by setting the docker_container.park_web_server.count property of the module.
If the module using the web_server sets count_of_containers to 5, the first docker container will have the name 'container-0'.
​The module using the web_server should pass in the count_of_containers variable by setting the count_of_containers property of the module.

Terraform Configuration Modules Variable New Public


Would you like to see our other questions?

We have 1000+ premium hand-crafted questions for 160+ job skills and 20+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.

Visit our question library
Private Concierge

Send us an email with an explanation of your testing needs and a list of candidates. We will create an appropriate test, invite your candidates, review their results, and send you a detailed report.

Contact Private Concierge

Would you like to see our tests? The following tests contain Terraform related questions:
On the TestDome Blog

Screening Applicants: The Good, the Bad and the Ugly

Since we’re all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they’ve been screening people for many years, so they must know how to do it right?

Not really. I was surprised to discover that many experts disagree with each other. Everybody praises their pet method and criticizes the others. Many of these methods look legitimate, but are based on...

Dashboard Start Trial Sign In Home Tour Tests Questions Pricing For Jobseekers