What is the difference between a module and a resource?

Hey Ibrahim! I’m not positive what you’re asking in the first sentence.

However, A Module is a container for multiple resources that are used together. The Modules section of the Terraform documentation is helpful here.

Regarding how resources access values from within a module, or as you asked how can a resource use something contained within a module, you’ll need to declare output values. The same page above has a specific section you can refer to on Accessing Module Output Values.

There’s also a really great introduction on the HashiCorp Learn Track for Terraform: Terraform Getting Started | Modules

Hope this helps.

3 Likes