nerdexam
HashiCorp

TA-002-P · Question #98

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

The correct answer is B. When a change is made to the resources via the Azure Cloud Console, Terraform will. Terraform state is not automatically updated by changes made in the Azure Cloud Console; Terraform detects this drift only during the next plan or apply operation.

Implement and maintain state

Question

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

Options

  • AWhen a change is made to the resources via the Azure Cloud Console, the changes are
  • BWhen a change is made to the resources via the Azure Cloud Console, Terraform will
  • CWhen a change is made to the resources via the Azure Cloud Console, the current state
  • DWhen a change is made to the resources via the Azure Cloud Console, the changes are

How the community answered

(37 responses)
  • A
    3% (1)
  • B
    89% (33)
  • C
    5% (2)
  • D
    3% (1)

Why each option

Terraform state is not automatically updated by changes made in the Azure Cloud Console; Terraform detects this drift only during the next plan or apply operation.

AWhen a change is made to the resources via the Azure Cloud Console, the changes are

Changes made in the Azure Cloud Console are not automatically reflected in the Terraform state file; the state file only updates when Terraform explicitly runs a refresh or apply operation.

BWhen a change is made to the resources via the Azure Cloud Console, Terraform willCorrect

When a resource is modified directly in the Azure Cloud Console, Terraform's state file remains stale and unaware of the out-of-band change. On the next 'terraform plan' or 'terraform apply' execution, Terraform calls the Azure provider APIs to refresh the actual resource state and compares it against the stored state, detecting the configuration drift. This drift detection behavior is a fundamental characteristic of how Terraform manages the relationship between declared configuration and real infrastructure.

CWhen a change is made to the resources via the Azure Cloud Console, the current state

The current state file is not automatically synchronized with out-of-band changes; it remains stale until Terraform actively queries the provider APIs.

DWhen a change is made to the resources via the Azure Cloud Console, the changes are

Out-of-band changes in the Azure Cloud Console are not automatically reconciled into the Terraform state; a 'terraform refresh' or 'terraform apply' is required to detect and record them.

Concept tested: Terraform state drift detection with Azure resources

Source: https://developer.hashicorp.com/terraform/language/state

Topics

#Terraform state#Drift detection#State management#External changes

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice