Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 195 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 195
Topic #: 1
[All Terraform Associate Questions]

You have been working in a Cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that is listening on port 80. After some application changes, you updated the Terraform code to change the port to 443.

You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended, and step away to grab some coffee.

In the meantime, another team member manually changes the load balancer port to 443 through the Cloud provider console before you get back to your desk.

What will happen when you terraform apply upon returning to your desk?

  • A. Terraform will fail with an error because the state file is no longer accurate.
  • B. Terraform will change the load balancer port to 80, and then change it back to 443.
  • C. Terraform will not make any changes to the Load Balancer and will update the state file to reflect any changes made.
  • D. Terraform will change the port back to 80 in your code.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
gekkehenk
Highly Voted 1 year, 10 months ago
Selected Answer: C
As the state is refreshed during the "apply" no changes will be made on the cloud. Terraform will rather update it state file.
upvoted 5 times
Daro_
1 year, 10 months ago
terraform apply command is not refreshing state, to detect drift without changing state file you need to type: terraform plan -refresh-only terraform apply, will change state file according to configuration file terraform
upvoted 1 times
Misiek
1 year, 2 months ago
The terraform apply command executes the actions proposed in a Terraform plan. Since the plan hasn't been save the plan will run again with apply. Command: plan The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. By default, when Terraform creates a plan it: Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date. Compares the current configuration to the prior state and noting any differences. Proposes a set of change actions that should, if applied, make the remote objects match the configuration.
upvoted 1 times
...
David_C_90
1 year, 8 months ago
When you run terraform apply without passing a saved plan file, Terraform automatically creates a new execution plan as if you had run terraform plan, prompts you to approve that plan, and takes the indicated actions. https://developer.hashicorp.com/terraform/cli/commands/apply#automatic-plan-mode
upvoted 2 times
...
...
...
shanker_sumit
Most Recent 1 year, 1 month ago
option A. Terraform will fail with an error because the state file is no longer accurate. As person has made the changes via the console not through terraform . Hence , it give an error as changes are made outside of terraform.
upvoted 1 times
...
camps
1 year, 7 months ago
Selected Answer: C
It's C
upvoted 1 times
...
sribalaje
1 year, 10 months ago
Selected Answer: C
C is correct answer
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...