tinycodinglm / ai /ai-0014.jsonl
winapiadmin's picture
Upload folder using huggingface_hub
1f3a244 verified
|
Raw History Blame Contribute Delete
1.23 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

How does Terraform manage state?

Assistant

Terraform state maps real-world resources to configuration. State is stored in a state file (terraform.tfstate) or remote backend.

State structure:

  • version: State file version
  • terraform_version: TF version used
  • resources: List of managed resources with attributes
  • outputs: Module outputs
  • serial: Incremented on each change

Remote backends:

  • S3 (with DynamoDB locking)
  • Consul (with locking)
  • Azure Blob Storage
  • Google Cloud Storage
  • Terraform Cloud

State locking:

  • Prevents concurrent modifications
  • Automatic lock acquisition on plan/apply
  • Manual unlock with terraform force-unlock

Best practices:

  • Never commit state to version control
  • Use remote backends for team collaboration
  • Enable state encryption at rest
  • Use workspaces for environment separation
  • Import existing resources with terraform import