learn-terraform

Course outlines for learning terraform.

View the Project on GitHub robertdebock/learn-terraform

Create module dependencies

expected time requirements
60 minutes A computer with Terraform installed.

Goal: Learn how module dependencies work in Terraform.

Explanation

Using modules make the root-module much easier to read, so you’ll likely end up writing and/or using modules.

Modules can depend on each other since Terraform 0.13. (August 2020)

Howto

You can simply use depends_on for an explicit dependency or refer to module.NAME.OUTPUT.

Demo

Have a look at this experiment

Assignment

Questions

  1. Are there differences in dependencies on resources and modules?
  2. In the example experiment; The dependency between module one and two is based on a (hidden, not exposed) artefact. How would you rewrite the code to make this dependency visible?

Notes

If you need to set an explicit dependency, reconsider if you are doing it wrong.