Search test library by skills or roles
⌘ K

Adaface Sample Terraform Questions

Here are some sample Terraform questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Medium

Dependencies and conditionals
Resources
Tags
Solve
Given the following Terraform code:
 image
What would be the value of the extra_security_group_id output when create_security_group is set to true, project_environment is set to "staging", and enable_additional_security_group is set to false?

Easy

Instance Security Group
AWS
Resources
Solve
Consider the following Terraform code:
 image
Which statement is true about this Terraform code?
            
            A. The code creates an EC2 instance and assigns an EIP to it within a VPC.
            B. The code creates an EC2 instance, but it is not associated with the specified security group.
            C. The code creates an EC2 instance and an EIP, but does not associate the EIP with the instance.
            D. The code creates a security group that allows SSH access to the EC2 instance from anywhere.
            E. The code creates an EC2 instance with the specified security group, but does not assign an EIP to it.

Medium

Resource Attributes
Resource Dependencies
Resource Attributes
Solve
Consider the following Terraform code snippet, which represents a simplified infrastructure for a web application:
 image
In the above code, a security group (`web`) and a web server (`web`) are being created. An Elastic IP (`web`) is also being created and associated with the web server. The `web` Elastic IP has a lifecycle policy that prevents it from being destroyed.
            
            Which of the following statements is true?
A: The Elastic IP (`web`) will not be associated with the `web` instance if the security group fails to create.
            B: The Elastic IP (`web`) can be disassociated manually in the AWS console without affecting the Terraform state.
            C: The Elastic IP (`web`) will be released when the `web` instance is destroyed.
            D: A Terraform destroy operation will fail due to the lifecycle policy of the `web` Elastic IP.
            E: The `web` instance must be manually terminated before the security group can be deleted.

Medium

Resource Lifecycle and Provisioners
Resource Lifecycle
Provisioners
Solve
Consider the following Terraform code snippet:
 image
This code creates a Google Compute Engine instance and uses a local-exec provisioner to print a message when the instance is created. It also has a lifecycle block that sets create_before_destroy to true.
            
            What will happen if you update the machine_type parameter for the google_compute_instance resource and execute terraform apply?
A: Terraform will fail to apply the changes due to the create_before_destroy lifecycle rule.
            
            B: Terraform will destroy the existing instance, create a new one, and the provisioner will print the message once.
            
            C: Terraform will create a new instance before destroying the old one, and the provisioner will print the message twice.
            
            D: Terraform will update the existing instance without creating a new one or destroying the old one, and the provisioner will print the message once.
            
            E: Terraform will create a new instance before destroying the old one, but the provisioner will print the message only once.
🧐 Question🔧 Skill

Medium

Dependencies and conditionals
Resources
Tags

3 mins

Terraform
Solve

Easy

Instance Security Group
AWS
Resources

2 mins

Terraform
Solve

Medium

Resource Attributes
Resource Dependencies
Resource Attributes

3 mins

Terraform
Solve

Medium

Resource Lifecycle and Provisioners
Resource Lifecycle
Provisioners

2 mins

Terraform
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Dependencies and conditionals
Resources
Tags
Terraform
Medium3 mins
Solve
Instance Security Group
AWS
Resources
Terraform
Easy2 mins
Solve
Resource Attributes
Resource Dependencies
Resource Attributes
Terraform
Medium3 mins
Solve
Resource Lifecycle and Provisioners
Resource Lifecycle
Provisioners
Terraform
Medium2 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1500+ companies in 80+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️