Welcome to the journey to conquer Terraform. In the first lesson we will learn what IaC (Infrastructure as Code) is, what Terraform is and why we need it.
From the name of Infrastructure as Code, we can simply understand that we will write code to describe and provide (provisioning) our Infrastructure. The word Infrastructure means system including the server, network, Gateway, Database, all the things needed to deploy our application on the server environment. Infrastructure as Code is best suited for infrastructure on a Cloud environment.
For example, on Alibaba Cloud, normally, we will log in to the Web Console, then we need a virtual machine, then we operate on the Console to create a virtual machine (ECS), we need a database, then we will operate on the web to create a database. And slowly, the system infrastructure will expand, this is when we will have problems, we will not know what the current system we have. In addition, what if someone deletes our ECS instance, we have to recreate it manually, but we don't know how the ECS instance was created with the config before, even if we note it, the Re-creation is very time consuming. And what if the entire Cloud infrastructure is down? Isn't it odd that we have to recreate the entire system infrastructure from scratch? IaC will help us solve the above problems, we will write code to describe and back up our infrastructure, if something happens like the whole infrastructure dies or someone fixes something wrong on our infrastructure then we can easily redeploy it.
In IaC languages, the most popular tool at the moment is Terraform. Terraform is developed by HashiCorp, dedicated to providing Infrastructure, we just need to write code, then type a few simple commands, it will create Infrastructure for us, instead of reaching out to the Web Console to click which is very time consuming. The flow of Terraform will be as follows, we write the code, then we type the command, and wait for Terraform to provide Infrastructure, after Terraform is finished creating it will create a file called Terraform State to save the current infrastructure architecture in it.
Next we make a small example to understand better. In this series, I will use Terraform to provide infrastructure on Alibaba Cloud.
To do this example requires you to have an Alibaba Cloud account and RAM User with Admin rights. Please follow the steps here: Create a RAM user and grant permissions to the RAM user .Then we install Terraform at this link: Install Terraform
In this example, we will use Terraform to create an ECS on Alibaba Cloud, the language Terraform uses is called HashiCorp Configuration Language (HCL).
The steps we take are as follows:
terraform init
commandterraform apply
commandterraform destroy
.command1 posts | 0 followers
FollowAlibaba Clouder - September 10, 2020
Alibaba Cloud Serverless - February 28, 2023
ClouderLouder - June 23, 2020
Alibaba Cloud Community - June 12, 2023
GAVASKAR S - September 22, 2020
Alibaba Clouder - July 2, 2020
1 posts | 0 followers
FollowA low-code development platform to make work easier
Learn MoreAccelerate software development and delivery by integrating DevOps with the cloud
Learn MoreAn enterprise-level continuous delivery tool.
Learn MoreFully managed, locally deployed Alibaba Cloud infrastructure and services with consistent user experience and management APIs with Alibaba Cloud public cloud.
Learn More