Terraform & IaC (50 Qs)•Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)
Explain Resource Lifecycle Rules: `create_before_destroy`, `prevent_destroy`, and `ignore_changes`.
senior LevelFormsLifecycleCI/CD & DevOps
In Simple Words:
create_before_destroy = true: Creates replacement resources before destroying the old ones. Prevents downtime when updating resources requiring replacement (e.g. launch templates, autoscaling groups).prevent_destroy = true: Causes Terraform to reject an apply and throw an error if an operation would destroy the resource. Essential for production databases and critical S3 storage.ignore_changes = [tags, instance_type]: Instructs Terraform to ignore external modifications to specific attributes (e.g. autoscaled capacities or auto-tagged resources).