The modules to be created via terraform can be run individually or all at once as per specific environments,provided the modules are same for all environnments.
-
Install kubectl using below command.
brew install kubectl
-
Initialize terraform modules
terraform init
-
Select a workspace as per the environments(dev,test,prod).
terraform workspace select <env_name>
eg:terraform workspace select prod
-
Run specific modules as per requirements.
terraform apply -target=module.<module-name>
eg:terraform apply -target=module.sql-database
-
Run all modules at once.
terraform apply
-
Destroy all modules at once.
terraform destroy