Terraform Interview Questions for Freshers/Terraform Interview Questions and Answers for Freshers & Experienced

What is Software Defined Networking?

Software-defined networking (SDN) technology is an approach to network management that enables dynamic, programmatically efficient network configuration in order to improve network performance and monitoring making it more like cloud computing than traditional network management.

Why write tests for Sentinel policies?

* Policies and infrastructure are prone to change for refactoring.

* Writing tests assures that your policy will continue to work as intended even if things change.

* Writing testing instils trust in the policymaking process.

How will you control and handle rollbacks when something goes wrong?

I need to recommit the previous code version to be the new and current version in my VCS. This would trigger as terraform run, which would be responsible for running the old code. As Terraform is more declarative, I will make sure all things in the code roll back to the old code. I would use the State Rollback Feature of Terraform Enterprise to roll back to the latest state if the state file got corrupted.

What is the different between Platform.sh and Terraform?

Platform.sh and Terraform are similar in that they both subscribe to the idea of "infrastructure as code".

Platform.sh is a second-generation Platform-as-a-Service built especially for continuous deployment. It allows you to host web applications on the cloud while making your development and testing workflows more productive whereas Terraform is an open-source infrastructure as code software tool that enables users to define and provision a data center infrastructure using a high-level configuration language known as Hashicorp Configuration Language, or optionally JSON.

What are some of the latest Terraform Azure Provider factors?

The latest versions involve new data resources and Azurem_batch_certificate, which helps in managing the certificate. This resource is used for controlling the prefix in networking. There is fixing of bugs, and azurerm_app_service has also been enhanced.

How will you make an object of one module available for the other module at a high level?

1. Ab output variable is defined in resource configuration.
2. Declare the output variable of module_A.
3. Create a file variable.tf for module B.
4. Establish the input variable inside this file having the same name as the key defined in module_B.
5. Replicate the process for making variable available to other modules0

How will you upgrade plugins on Terraform?

Run ‘terraform init’ with ‘-upgrade’ option. This command rechecks the releases.hashicorp.com to find new acceptable provider versions. It also downloads available provider versions. “.terraform/plugins/<OS>_<ARCH>” is the automatic downloads directory.

Can terraform be used for on-prem infrastructure?

Yes, Terraform can be used for on-prem infrastructure. There are many providers that are available. you can choose any one of them which suits you best. Many also build customer terraform providers for themselves, all needed is just an API.

How to lock Terraform module versions?

A proven way of locking Terraform module version is using the Terraform module registry as a source. We can use the ‘version’ attribute in module of the Terraform configuration file. As the Github repository is being used as a source, we need to specify versions, branch, and query string with ‘?ref’.

What do you mean by IAC in Terraform?

IAC is an abbreviation to the term "Infrastructure as Code". IaC refers to a system whereby developers can manage and provision the computer data centers automatically instead of getting into a manual process. Terraform, for instance, is an example tool of IaC.

What do you understand by a Tainted Resource?

A tainted resource is a resource that is forced to be destroyed and recreated on the next apply command. When a resource is marked as tainted, the state files are updated, but nothing changes on infrastructure. The terraform plan out shows that help will get destroyed and recreated. The changes get implemented when the next apply happens.

Explain State File Locking?

State file locking is Terraform mechanism in which operations on a specific state file are blocked to avoid conflicts between multiple users performing the same process. When one user releases the lock, then only the other one can operate on that state. This helps in preventing state file corruption. This is a backend operation.

What is Terragrunt, and what are its uses?

Terragrunt is a thin wrapper that provides extra tools to keep configurations DRY, manage remote state and work with multiple Terraform modules. It is used for:

* Working with multiple AWS accounts.
* Executing Terraform commands on multiple modules

* Keeping our CLI flags DRY
* Keeping our remote state configuration DRY
* Keeping our Terraform code DRY

What are the various levels of sentinel enforcement?

Sentinel is a powerful tool that can be used to implement a variety of policies. Here are a few examples:
<> Advisory :
* Logged but allowed to pass
* When a user triggers a plan that violates the policy, an advisory is issued to the user.

<> Soft-Mandatory :
* Teams based permissions for overrides
* Overrides logged for audit if the policy fails
* Prevents non-compliant infrastructure from being deployed by regular users. Only administrators have the ability to overrule.

<> Hard-Mandatory :
* Default enforcement level
* The policy must pass
* Only way to override is to explicitly remove the policy
* Prevents non-compliant infrastructure from being deployed by all users and apps.

Can you provide few examples where we can use for Sentinel policies?

Sentinel is a powerful tool that can be used to implement a variety of policies. Here are a few examples:
Security Standards

* Forbid or allow only certain resources, providers or data sources
* Restrict roles the cloud provider can assume
* Restrict roles the cloud provider can assume

Audit Tracking

* Review an audit trail for Terraform Cloud operations
* Enforce explicit ownership in resources

Resource Restriction

* Limit the size of VMs and clusters for cost
* Enforce mandatory tagging on resources built with Terraform
* Restrict modules to your organizations Private Module Registry

What exactly is Sentinel?

Sentinel is the policy enforcement language used by HashiCorp. Sentinel policies are validated when the Terraform plan is executed. Sentinel will detect incorrect settings before they reach production, not later.

What are the disadvantages of maintaining the Terraform state file on the local machine?

** State file sometimes contains secrets or sensitive data may be exposed
** We are unable to collaborate with the team because the file is on someone's laptop.
** On a local machine, there is a possibility of losing or deleting the state file.
** There is no centralised record keeping to track historical developments.

How does terraform integrate with github and public cloud?

The majority of businesses are migrating to the public cloud. Managing infrastructure in a secure and controlled manner is a critical step for businesses.

Check out this Terraform + GCP + Git Complete Example to learn how to use terraform to provision infrastructure on Cloud while keeping the infrastructure code in a github repository.

Tell us about some notable Terraform applications.

The applications of Terraform are pretty broad due to its facility of extending its abilities for resource manipulation. Some of the unique applications are:

* Software demos development
* Resource schedulers
* Multi-cloud deployment
* Disposable environment creations
* Multi-tier applications development
* Self-service clusters
* Setup of Heroku App

What is Terraform Enterprise

Terraform Enterprise is the same tool, but it runs in your own data centre or cloud environment. Some users want more control over the Terraform Cloud application, or they want to execute it behind corporate firewalls in restricted networks.

Which command destroys Terraform managed infrastructure?

The given command is used for this purpose:

terraform destroy [options] [dir]

What are some of the built-in provisioners available in Terraform?

Here is the list of built-in provisioners in Terraform:

* Salt-masterless Provisioner
* Remote-exec Provisioner
* Puppet Provisioner
* Local-exec Provisioner
* Habitat Provisioner
* File Provisioner
* Chef Provisioner

What do you mean by terraform init in the context of Terraform?

The terraform init command creates a working directory in which Terraform configuration files can be found. After creating a new Terraform configuration or cloning an old one from version control, run this command first. It is safe to use this command more than once. Despite the fact that successive runs may result in errors, this command will never overwrite your current settings or state.

Name all version controls supported by Terraform

The supported version controls are:

* Azure DevOps Services
* Azure DevOps Server
* Bitbucket Server
* Bitbucket Cloud
* Gitlab EE and CE
* Gitlab.com
* GitHub Enterprise
* GitHub.com (OAuth)
* GitHub.com

How is duplicate resource error ignored during terraform apply?

We can try the following options:

1. Delete those resources from the cloud provider(API) and recreate them using Terraform
2. Delete those resources from Terraform code to stop its management with it
3. Carry out a terraform import of the resource and remove the code that is trying to recreate them

Does Terraform support multi-provider deployments?

Yes, multi-provider deployments are supported by Terraform, which includes on-prem like Openstack, VMware, and we can manage SDN even using Terram too.

Is Terraform usable for an on-prem infrastructure?

Yes, Terraform can be used for on-prem infrastructure. As there are a lot of obtainable providers, we can decide which suits us the best. All that we need is an API.

What are the version controls supported by Terraform besides GitHub?

The version controls supported GitLab EE, GitLab CE, and Bucket cloud.

Next up, let us see some intermediate terraform interview questions!

What do you understand by terraform backend?

A backend in Terraform is used to determine how an operation is executed and how the state is loaded. Terraform using the ‘local’ backend by default. The abstraction enables remote execution, non-local file state storage, etc.

Explain Oracle Cloud Infrastructure.

Oracle cloud offered by Oracle Corporation is a cloud computing service providing storage, servers, applications, services, and network through a global network of managed data centers by Oracle Corporation. These services are provisioned on-demand over the Internet by the company.

Define null resource in Terraform.

null_resource implements standard resource library, but no further action is taken. The triggers argument allows an arbitrary set of values that will cause the replacement of resources when changed.

Is it feasible to use Terraform on Azure with callbacks? Sending a callback to a logging system, a trigger, or other events, for example?

Yes. Azure Event Hubs can be used to accomplish this. This capability is now accessible in the Terraform AzureRM provider. Terraform's Azure supplier provides users with simple functionality. Microsoft Azure Cloud Shell includes a Terraform occurrence that has already been setup.

Why is Terraform used for DevOps?

This is because Terraform manages infrastructure as code. Infrastructure as code is the foundation for DevOps practices such as continuous integration, version control, continuous deployment, and code review.

Is history the same as it is on the web while using TFS API to provide resources?

Yes, the narration is similar to on the web because UI keeps API as the base. The whole thing that is on the UI is availed during other methods and the API.

What do you understand by Terraform in AWS?

Terraform is an infrastructure as code tool that permits us to store our Amazon Web Services infrastructure and produce an update. It is comparable to AWS Cloud Formation.

What is Terraform D?

Terraform D is a plugin used on most in-service systems and Windows. Terraform init by default searches next directories for plugins.

What is Terraform init?

Terraform init is a control to initialize an operational index that contains Terraform pattern files. This control can be looped multiple times. It is the first command that should be run after writing the new Terraform design.

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:

* Audit logging
* SAML single sign-on.

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.

Enlist some Built-in Provisioners available in Terraform?

Below is the list of some Built-in provisioners in Terraform:

* Chef Provisioner
* File Provisioner
* Habitat Provisioner
* Local-exec Provisioner
* Puppet Provisioner
* Remote-exec Provisioner
* Salt-masterless Provisioner

For what provisioners are used in Terraform?

Provisioners in Terraform 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.

What is a provider in Terraform? Enlist some Terraform Providers.

Terraform provider is responsible for understanding API interactions and exposing resources. Providers generally are an IaaS (e.g. Alibaba Cloud, AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g. Heroku), or SaaS services (e.g. Terraform Cloud, DNSimple, Cloudflare).

Some Terraform providers are:

* IaaS services: Examples are Alibaba Cloud, AWS, GCP, Microsoft Azure, OpenStack.
* PaaS services: Examples are Heroku.
* SaaS services: examples are Terraform Cloud, Cloudflare, DNSimple

In which programming language Terraform is written?

Terraform is an open-source tool created by HashiCorp and written in the Go programming language.

List some major competitors of terraform?

Ansible, Kubernetes, Packer, Cloud Foundry, and Pulumi are the most popular alternatives and competitors to Terraform.

Explain the architecture of terraform?

The architecture of terraform consists of following components:

* CLI (Command Line interface)
* Backends for executing operations,storing state, and storing workspace-defined variables
* Configuration Loader
* State Manager
* Graph Builder
* Graph Walk
* Vertex Evaluation
* Expression Evaluation
* Sub-graphs

What does HCL stand for?

In Terraform HCL stands for HashiCorp Configuration Language. It is a configuration language built by HashiCorp that is used to build a structured configuration language that is both human and machine-friendly for use with command-line tools but specifically targeted towards DevOps tools, servers, etc.

What is terraform in aws?

Terraform by HashiCorp, an AWS Partner Network (APN) Advanced Technology Partner and member of the AWS DevOps Competency, is an "infrastructure as code" tool similar to AWS CloudFormation that allows you to create, update, and version your Amazon Web Services (AWS) infrastructure.Terraform by HashiCorp, an AWS Partner Network (APN) Advanced Technology Partner and member of the AWS DevOps Competency, is an "infrastructure as code" tool similar to AWS CloudFormation that allows you to create, update, and version your Amazon Web Services (AWS) infrastructure.

Why Terraform is preferred for DevOps?

There are a bunch of reasons for giving preference to Terraform to be used as one of the significant tools of DevOps. The main motive of DevOps is to bring efficiency and quality in software delivery. For this, some tools are required for making the delivery smoother, faster and efficient. Here, terraform comes to the limelight where it aids organizations in automating and also aids with infrastructure as code. Terraform is helpful with its availability of implementing every type of coding principle. The extraordinary feature of terraforming includes its quickness and the operations performed by it. These are some of the important reasons for which Terraform is gaining popularity and attention in the organizations.

Enlist major features of Terraform?

The key features of Terraform are

* Infrastructure as Code (IAC)
* Execution Plans
* Change Automation
* Resource Graph

What is Terraform?

Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language, or optionally JSON.

Search
R4R Team
R4R provides Terraform Freshers questions and answers (Terraform Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,Terraform Interview Questions for Freshers,Terraform Freshers & Experienced Interview Questions and Answers,Terraform Objetive choice questions and answers,Terraform Multiple choice questions and answers,Terraform objective, Terraform questions , Terraform answers,Terraform MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for Terraform fresher interview questions ,Terraform Experienced interview questions,Terraform fresher interview questions and answers ,Terraform Experienced interview questions and answers,tricky Terraform queries for interview pdf,complex Terraform for practice with answers,Terraform for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .