AWS Infrastructure as Code using Terraform script

Before getting in to Terraform script, lets find our difference between two popular tools –
CloudFormation vs. Terraform:

Both tools provide a template (CloudFormation) or configuration (Terraform) describing the target state of your infrastructure. Also both tools (CloudFormation or Terraform) calculates the necessary steps to reach the defined target.Both the tool (CloudFormation or Terraform) executes the changes.

Existing Resources:
CloudFormation does not allow, only possible way to use input parameters of existing resources.
Terraform allows importing existing resources as well as using data sources to discover and integrate with other resources.

License and Support:
Managed Services offered by AWS for Free. Support included with AWS support
Open Source project and Hashicorp is offering enterprise product if needed.

Modularization:
Different approaches like Nested stacks, Export/Import etc
Modules in Terraform are self-contained packages of Terraform configurations that are managed as groups.

Rolling Update:
A rolling update of EC2 instances managed by an Auto Scaling Group is supported.
Does Not support.

Scope:
Covers almost all services and features provided by AWS
Covers almost all services and features provided by AWS. Additionally other cloud providers and 3rd party services are supported as well.

Stage Management:
The state is managed by CloudFormation out-of-the-box. Prevents conflicting changes.
The state is stored on local disk by default. Supports backends (eg. S3 and DynamoDB) to synchronize state and state locking.

Verify Changes:
Using Change sets allow you to verify changes before execute these changes on the stack.
Terraform allows to create detail execution plan before applying changes.

Terraform Installation and Guide:

1. Follow instructions given in following link to install terraform binary –

https://www.terraform.io/intro/getting-started/install.html

2. Follow initial build script to learn initial steps

https://www.terraform.io/intro/getting-started/build.html

Share this post

AWS Infrastructure as Code using Terraform script

Leave a Reply

Your email address will not be published. Required fields are marked *