A module is a container for multiple resources that are used together. Modules can be used to create lightweight abstractions, so that you can describe your infrastructure in terms of its architecture, rather than directly in terms of physical objects.
A Terraform module is very simple: any set of Terraform configuration files in a folder is a module.
Create a new folder called modules and move all the files (that is, main.tf, variables.tf, and outputs.tf) from the web server cluster into modules/services/webserver-cluster.
Open up the main.tf file in modules/services/webserver-cluster and remove the provider definition.
Providers should be configured by the user of the module and not by the module itself.
$ tree minimal-module/