What Are Terraform Modules and How Do They Work?
What does a module do? A Terraform module allows you to create logical abstraction on the top of some resource set. In other words, a module allows you to group resources together and reuse this group later, possibly many times. Modules: Definitions Root Modules Child Modules The output block and how it’s used in Modules One of the uses of an output block is to expose a subset of the module’s resource attributes to a parent module. As a precursor to Module Composition , bellow is an illustration of how outputs are used in modules: Let's assume we have a virtual server with some features hosted in the cloud. What set of resources might describe that server? For example: the virtual machine itself, created from some image an attached block device of a specified size for additional storage a static public IP mapped to the server's virtual network interface a set of firewall rules to be attached to the server other things like another block device, additional network interface,...