Control replace/delete behavior and ignored drift.

Section: Meta-arguments

Lifecycle rules

hcl
hcl
resource "aws_s3_bucket" "logs" {
  bucket = var.bucket_name
  lifecycle {
    prevent_destroy = true
    ignore_changes  = [tags]
  }
}
Explanation

Control replace/delete behavior and ignored drift.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Meta-arguments
Use count
Create multiple similar resources with count.
OpenIn sheethclsame section
Use for_each
Create resources keyed by map/set members.
OpenIn sheethclsame section
Explicit dependency
Force resource ordering when dependency is not inferred from arguments.
OpenIn sheethclsame section
String variable
Declare a typed string variable.
OpenIn sheethcl1 tag match
Conditional expression
Choose values conditionally.
OpenIn sheethcl1 tag match
Dynamic block
Generate repeated nested blocks from input data.
OpenIn sheethcl1 tag match