Below are few major features of Terraform
Q1. What is Terraform?
Terraform is a popular tool to manage service providers, and for creating, modifying and versioning infrastructure securely and efficiently. It adequately generates an execution plan to reach the desired state and then execute it to build the desired infrastructure. Along with that, it is also capable to tell which changes can be applied to execution plans for better performance.
Low-Level components such as storage, networking, etc. and high-level components such as SaaS features, DNS entries, etc. are also managed by the infrastructure Transform.
Q2. Enlist major features of Terraform?
The major features of Terraform are:
Q3. In which programming language Terraform is written?
Terraform supports plugin model and plugins are issued as Go binaries. Technically, Plugins can also be written in another language, but all plugins preferred Go. With the use of high-level configuration language HCL( Hashicorp Configuration Language), it enables the users to provide a data center infrastructure.
Q4. What is use of Terraform CLI? Enlist few major command.
Terraform is controlled very easily with the command-line interface (CLI). The CLI is a well-mannered command-line application that takes subcommands such as "apply" or "plan". If there is an error, in any case, the CLI returns the non-zero exit status. If you want to view a list of commands supported by Terraform, run terraform with no arguments.
Common Terraform Commands are:
Q5. What is a provider in Terraform? Enlist some Terraform Providers.
A provider is basically liable for exposing resources and understanding of API interactions.
Some Terraform providers are:
Q6. For what provisioners are used in Terraform?
Provisioners can be used to prepare servers or other infrastructure objects for service. It models specific actions on the local machine as well as on remote machines.
Q7. Enlist some Built-in Provisioners available in Terraform?
Below is the list of some Built-in provisioners in Terraform:
Q8. What are Modules in Terraform?
A module in Terraform is a container for several resources that are used together. The root module is compulsory for every terraform that includes resources mentioned in the .tf files.
Q9. What is Terraform cloud? Enlist few features provided by it?
Terraform Cloud is an application that let the teams use the Terraform together. It runs in a reliable environment and includes easy access to shared state and secret data. It provides access controls for adopting changes to infrastructure and a private registry for sharing terraform modules.
Features of the Terraform cloud are:
Q10. How to check installed version of Terraform?
To check the installed version of Terraform, use the below command:
terraform [-version] [-help] [args]
Q11. What are provisioners in Terraform?
Provisioners in Terraform is used to execute scripts or shell commands to model specific actions on a local machine. Actions such as resource creation/deletion are executed on the local machine. They add certain complexity to the terraform. Because terraform cannot model the actions of the provisioners as part of a plan. Also, the successful use of provisioners requires coordination for many more details than terraforming usually requires.
But the provisioners do help in executing script on a local machine, executing remote script on a resource, executing configuration management tools on the remote resource, etc.
Q12. What is Terragrunt?
Terragrunt is a thin wrapper around Terraform. It provides extra tools. These tools are used for keeping your configurations DRY, working with multiple Terraform modules, and managing remote states. Terragrunt is used to your Terraform code DRY. They are also used to create and manage remote configurations.
You can also execute Terraform commands on multiple modules at once using Terragrunt.
Q13. What is terraform backend?
A backend in terraforming is used to determine how the state is loaded and how an operation is executed. By default, Terraform uses a local backend. An important thing to know is that Backend in Terraform is optional.
Terraform can be used without learning or using the Backend. But Backend has some benefits such as using it to store sensitive information off the disk, executing remote operations, and storing the state remotely, and preventing it from corruption
Q14. What is terraform state?
The state is used by the Terraform to map the real-world resources to your configuration. It is also used to keep track of the metadata, and to improve the performance of large infrastructures.
For this to happen, Terraform must store the state of your configuration and managed infrastructure. The state is stored in the local filename named "terraform.state". This state is used to create plans and make changes to your infrastructure.
Q15. What is terraform init?
The init is a command in Terraform that is used to perform several different initialization steps. It is done in order to prepare a working directory. It is executed to bring the working directory up to date with the changes in the configuration.
//syntax terraform init [options] [DIR]
If no arguments are passed for the directory parameter, then the current working directory is initialized.
Q16. What is use of fmt command in Terraform?
The fmt command in Terraform is used to rewrite Terraform configuration files. It rewrites the file to a canonical format and style. It applies a subset of the Terraform language style conventions to the files.
//syntaxterraform fmt [options] [DIR]
If the directory argument is not passed, then the command scans the current directory for the configuration files. The list of flags available to this command is -list, -write, -diff, -check, -recursive.
Q17. What do you mean by IAC in Terraform?
IAC is Infrastructure as Code. It means writing code to provision, manage, and deploy IT infrastructure. Nowadays, all companies use IAC to spin up servers in different service providers like AWS, or GCP.
Terraform is used to build and deploy the infrastructure using a configuration file with the .tf extension. You can write the desired end state in the configuration file and Terraform will take the required steps to achieve the end state.
Q18. How do you manage multiple versions of Terraform?
You can manage multiple versions of Terraform using the Tfenv file.
Q19. How do you recover from a failed apply, where some resources were provisions, but others were not?
We can recover from a failure to apply,r ranging from the use of --force, as well as manually removing resources, cleaning up the S3 state files, and cleaning the dynamo DB lock.
Q20. How do you/should you deal with versioning in Terraform?
Semantic Versioning of Modeled should be used. Apply should only be done with Versioned modules/tags.