Terraform Workflow
The fundamental Terraform workflow consists of three primary steps:
1. Definition / Write
- In the initial stage, users create Terraform configuration files in HashiCorp Configuration Language (HCL), a human-readable language.
- For example, one may have a main.tf file which uses Terraform syntax to declare AWS EC2 instances, security groups and S3 buckets as resources.
- Users then specify the resources they want to create with terraform, like virtual machines, networks or their respective configurations.
2. Terraform Plan
- After writing the Terraform configuration files, you can execute the terraform plan command.
Terraform plan
- The plan stage enables terraform to read the configuration files and compare what is desired state specified in your configuration file with the current state of your infrastructure.
- When using the plan command it means that you are not affecting any changes on your infrastructure, rather it will show you how terraform intends to behave if you apply any changes bring in by your configuration.
3. Execution/ Apply
- Running the terraform apply command allows user to apply the changes in their execution plan.
terraform apply
- This implies that Terraform is going to execute all the planned actions and make every necessary change on infrastructure so as bring it to the desired state as described in configuration files.
- Terraform will build, change or destroy infrastructure resources as required by the configuration file during this phase.
- After a successful completion of applying process, infrastructure will be provisioned or updated based on the specification given in Terraform configuration files.
Creating SNS And SQS Using Terraform
Terraform, is an open-source and specific infrastructure as a code (IaC) tool developed by HashiCorp. that helps the Terraform users to build, change, and version their infrastructure in the most secure and efficient way. using terraform, users can manage resources such as virtual machines, storage, and network through infrastructure provisioning and management.
terraform helps to implement infrastructure provisioning and management across different environments in a single process, regardless of whether these environments are on-premises or in the cloud.