When you execute terraform apply, Terraform creates a new execution plan by comparing the current state file to the desired state declared in the configuration. After creating the execution plan, Terraform presents the proposed changes and asks for confirmation to apply them. Once you confirm the changes, Terraform updates the state file with the new state reflecting the changes that were made. Terraform then submits the change requests to the resource provider to make the desired changes in the cloud environment. The amount of time it takes for the resource provider to fulfill the requests can vary depending on the resources being modified.
From https://developer.hashicorp.com/terraform/tutorials/cli/apply
When you apply this configuration, Terraform will:
1) Lock your project's state
2) Create a plan, and wait for you to approve it.
3) Execute the steps defined in the plan using the providers you installed when you initialized your configuration. Terraform executes steps in parallel when possible, and sequentially when one resource depends on another.
4) Update your project's state file with a snapshot of the current state of your resources.
5) Unlock the state file.
6) Print out a report of the changes it made, as well as any output values defined in your configuration.
Changes in the cloud environment are made on step 3, before updating the state file
I vote for B. The difference between B and C is that we have to count on timeout cases in the real world, e.g. provision GCP DataProc cluster, MongoDB Atlas, etc. It's possible the provisioner timeout but the provider keeps going till the job finish. In this case the local terraform state file does not sync with the physical infra - terraform did try to update but timeout. Then we run `terraform apply` again and the state file reconciles with the physical infra.
If you are creating a new virtual machine using Terraform, it may take a few minutes for the virtual machine to be created and for it to become available for use. During this time, Terraform will continue to report on the progress of the creation process and will display any errors or issues that may arise. Once the virtual machine has been successfully created, the changes will be reflected in your cloud environment. I go with B
Given it has more than 4 options, I think it should have multiple valid answers, and hence both B & C should be selected. Again, this is assumption based as this is missing in question.
When does terraform apply reflect changes in the cloud environment?
Terraform will apply chnages to the cloud, then it will update the state file. After it updates the statefile only it "reflects" those changes to the screen
This is not what the question is asking. The question is not asking when it will reflect the changes in the "screen". It is asking when it will reflect the changes in the "cloud environment". And this will be whenever it finishes deploying the resources. "B" is the correct answer for sure.
I vote C because the question is "When" and from the docs:
Terraform plan and apply operations run an implicit in-memory refresh as part of their functionality, reconciling any drift from your state file before suggesting infrastructure changes.
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.
Nunyabiznes
Highly Voted 1 year, 8 months agoliuyomz
7 months agovitasac
Highly Voted 2 years, 6 months agoforeverlearner
Most Recent 1 year, 4 months agozanhsieh
1 year, 6 months agoNi33
1 year, 6 months agoPower123
1 year, 7 months agoChaks1985
1 year, 10 months agoInformationOverload
1 year, 10 months agoFarziWaliMarzi
1 year, 11 months agofaltu1985
2 years, 1 month agoNightducky
2 years, 1 month agoRVivek
2 years, 2 months agopas77
2 years agonhatne
2 years, 4 months agoEltooth
2 years, 4 months agoZam88
2 years, 5 months agoAzureGurl
2 years, 5 months agotemp111
2 years, 6 months agoIpergorta
2 years, 6 months ago