HashiCorp Configuraton Language (HCL) Basics

Search for a command to run...

No comments yet. Be the first to comment.
In this series we will discuss the concept of Infrastructure as code, the types of it and various IAC tools and their features
Let us discuss the concept of IAC before we discuss about Terraform Lets look at the traditional way of IT delivery to appreciate the utility of IAC tools. The Traditional Way of managing Infrastructure. App delivery in a traditional IT environment T...
Hello everyone. Welcome Back to the series after a very long time. The delay wasn’t intentional but it so happened. Hoping to be consistent henceforth. In the previous article of the series, we discussed in brief all the three ways. Now in this one, ...

Welcome back to the AWS SAA series. We will continue from where we left in the last blog. Buckets aren’t encrypted. But Objects are. Each object could be using different encryption settings. There are two main types of encryption at rest: Client sid...

The next topic in our series would be about Key Management Service before we can discuss how encryption happens in the S3 buckets. This is a separate topic in itself. Lets start. AWS Key Management Service (AWS KMS) lets us create, manage, and contro...

Hello there, continuing with our series, lets look into AWS S3 Performance optimization w.r.t uploads Single PUT upload This is the S3 Default upload method The data is transferred in a single stream to S3 A file becomes an object and is uploaded usi...

Object versioning is a feature which can be enabled on an S3 bucket - allowing the bucket to store multiple versions of objects These objects can be referenced by their version ID to interact directly - or omit this to reference the latest version of...

Hello Folks, we are moving ahead with our Infrastructure as Code series with Terraform. We are going to discuss the basics of HCL the language used in the terraform tool. The new name for this language is Terraform Language in the newer versions. Let's get started.
This is for version 0.11 or earlier. An HCL file has blocks and arguments A block is defined within curly braces and contains arguments in key value pair format representing config data.
What information is kept in the block The platform and the resources in the platform First element is block called resource block id by word resource Then we have the resource type and then inside the resource block we have arguments in the form of key value pair
Simple Terraform workflow is as follows
When we run the terraform init command, Terraform will check the configuration file and initialize the working directory containing the .tf file. It will understand the resource type and download the appropriate provider to work on the resources declared in the .tf file Now the resource can be created.. If we want to see the steps involved in the creation of the resource, run the terraform plan command. The + symbol signifies that resource will be created. Once we have verified all the steps, run the terraform apply command. It will show the execution plan once again and ask the user’s confirmation to proceed with the steps. Then run the terraform show command to view the details of the created resource. To know the resource types supported by a provider and the arguments needed, refer to the terraform documentation.
Once the necessary changes are done When the terraform plan is run, the output shows that resource will be replaced -/+ shows that the resource will be deleted and recreated Even though the change is small, Terraform will delete and recreate the file This infrastructure is called immutable infrastructure. To continue with the change, run the command terraform apply and type yes to confirm To destroy the infrastructure, run the command terraform destroy An execution plan is shown and when we give the confirmation yes, terraform proceeds to perform the action.