We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
Terraform
An IaC tool.
By- Bandan Kumar Sahoo
What is IaC? Why Terraform? IaC stands for Infrastructure as a Code. This is a process of creating infrastructure through code and not in the manual process. Terraform is an IaC tool that uses HCL language to write code and spin up infrastructure. What are modules in Terraform? It is the logical grouping of resources let's say we are spinning up a loadbalancer or EC2 instance and other team is also doing the same thing. So, we can create modules in terraform which is nothing but the common code that can be shared to other groups and then can put their values accordingly. What is state file in Terraform? a) It keeps track of the resources that terraform is managing. b) If any new resource is created or old is deleted, terraform keeps the track and alos tells the same to the user.
What are some most commonly
Terraform CLI commands that is used frequently? i) terraform init ii) terraform validate iii) terraform plan iv) terraform apply v) terraform refresh. What is terraform remote backend? It is the location where terraform state file is stored remotely in a repository like S3 to version control the HCL code written for infrastructure spin up. When working in a team or with multiple environments, it's essential to store the state remotely, allowing collaboration and synchronization among team members. What is resource graph terraform? When you write terraform code, you define resources and their relationships using the HCL. Terraform uses this information to build the resource graph, which determines the order in which resources are created, updated or desttroyed to maintain consistency and avoid potential dependency issues. What is tainted terraform resources? In Terraform, when a resource is marked as tainted, it means that terraform considers the resource to be in an invalid or unknown state. Tainting a resource is a way to flag it for destruction and recreation during the next terraform run.
What is terraform state rollback?
S3 stores all the version of state files fetch the previous version you want to apply for terraform through aws cli and replace it with new one as a new version in S3. Then simply "terraform apply". This will apply the old version of terraform If terraform.tf state file is deleted what can be done? There will be massive overlap between the resources if terraform apply comand is run again because terraform will not realise the previously created resource as there is no track. solution : Here "terraform import" command is used to import existing infrastructure into your terraform state.
What are features of Terraform?
a) It allows creation of infrastructure in multi-cloud environment such as AWS, Azure & GCP. b) It maintains a state file which is version controlled and this keeps the track of changes in infrastructure. What is the functionality of "terraform validate" command? a) It checks the syntax of all the created .tf files in terraform. b) It doesn't check the spaces and all but checks if any modules are relative, invalid HCL references, missing equal signs, etc.
20+ resource running on terraform
and we have to destroy one. terraform destroy -- target=resource_type.resource_nam e What is the functionality of "terraform validate" command? a) It checks the syntax of all the created .tf files in terraform. b) It doesn't check the spaces and all but checks if any modules are relative, invalid HCL references, missing equal signs, etc.
20+ resource running on terraform
and we have to destroy one. terraform destroy -- target=resource_type.resource_nam e Drawbacks of Terraform.
a) Restricted to one language.
b) Even if terraform plan is executed successfully, terraform apply fails sometime. c) State is fragile means by anychance you delte the resource manually, you need to manually change the state file. d) Terraform cloud is a vendor lock and third party dependency you can't diagnose.The most irritating thing is "you have exceeded the API's rate limit" Thank You