Reusability in terraform
Create a vpc in AWS in mumbai
- Refer Here for vpc module
- Refer Here for the changes
Create a module to create aws security group
- Refer Here for the module created to create an aws security group
-
Now lets try to use this module from local path
Refer Here - Try creating 2 security groups one in mumbai and one in oregon
- Refer Here for module submitted in git
Concepts: Module
- Refer Here for official docs
- Terraform registry is collection of public modules
- modules can be used from various sources Refer Here
- Terraform supports connecting to same cloud using provider with alias for different configurations as part of one deployment
- In AWS if we want terraform to create resources in two different regions or two different accounts
- In Azure to create resources in two different subscriptions/accounts