AWS provider Resource Lifecycle Management Practice Question
You have an AWS Lambda function that should be replaced whenever the source code S3 object changes. How do you trigger this replacement specifically based on the S3 object key change?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use replace_triggered_by = [aws_s3_object.lambda_code.key]
The replace_triggered_by meta-argument allows forcing a resource to be replaced when another specified resource or attribute changes.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use lifecycle { force_replace = true }
Why it's wrong here
This is not a valid lifecycle meta-argument.
- ✓
Use replace_triggered_by = [aws_s3_object.lambda_code.key]
Why this is correct
This correctly references the attribute change to trigger replacement.
- ✗
Use create_before_destroy.
Why it's wrong here
This only controls the timing, not the trigger for replacement.
- ✗
Use ignore_changes = [source_code_hash]
Why it's wrong here
This would prevent Terraform from detecting code changes.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
About these practice questions
One of 193 original AWS provider practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official HashiCorp exam blueprint
This AWS provider practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AWS provider exam.