Skip to content

Conversation

@npwolf
Copy link

@npwolf npwolf commented Dec 20, 2025

what

  • Add new variable cloudfront_ignore_etag_changes to allow users to ignore changes to the CloudFront distribution etag attribute
  • Implement lifecycle rule on aws_cloudfront_distribution resource that conditionally ignores etag changes based on the variable value
  • Update README.md with auto-generated documentation for the new variable

why

  • When external processes update CloudFront distributions (e.g., automated configuration management), the etag changes
  • These etag changes appear in Terraform plans and state, causing unnecessary noise
  • Since etag is a read-only computed attribute, Terraform cannot revert these changes anyway
  • Users need a way to suppress these benign state changes while still tracking meaningful configuration drift
  • Defaults to false to maintain backward compatibility with existing deployments

references

  • Addresses use case where external automation modifies CloudFront alongside Terraform-managed infrastructure

Add new variable `cloudfront_ignore_etag_changes` to allow users to ignore changes to the CloudFront distribution etag attribute via lifecycle rules. This is useful when external processes update the CloudFront distribution, causing the etag to change and appear in Terraform plans and state.

Defaults to false to maintain backward compatibility.
@npwolf npwolf requested review from a team as code owners December 20, 2025 00:29
@coderabbitai
Copy link

coderabbitai bot commented Dec 20, 2025

📝 Walkthrough

Walkthrough

This pull request adds a new boolean variable to control whether Terraform ignores etag changes on CloudFront distributions, and implements a conditional lifecycle block that selectively ignores etag modifications when enabled.

Changes

Cohort / File(s) Summary
CloudFront etag ignore logic
main.tf, variables.tf
Added cloudfront_ignore_etag_changes boolean variable (default: false) with documentation. Implemented conditional lifecycle block in aws_cloudfront_distribution.default to ignore etag changes when variable is set to true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Variable addition is straightforward with clear documentation
  • Lifecycle block uses simple conditional logic
  • Changes are isolated and follow standard Terraform patterns
  • Limited scope affecting only two files with cohesive functionality

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'feat: add option to ignore CloudFront distribution etag changes' accurately describes the main change in the changeset: adding a new variable and lifecycle rule to conditionally ignore etag changes on CloudFront distributions.
Description check ✅ Passed The pull request description is well-related to the changeset, providing clear context about what was changed (new variable and lifecycle rule), why it was needed (external processes causing etag noise), and implementation details (defaults to false for backward compatibility).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0710df3 and 98b2487.

⛔ Files ignored due to path filters (1)
  • README.md is excluded by !README.md
📒 Files selected for processing (2)
  • main.tf (1 hunks)
  • variables.tf (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (2)
main.tf (1)

479-481: LGTM! Clean implementation of conditional lifecycle rule.

The conditional ignore_changes logic is well-structured and addresses the stated use case of suppressing etag drift from external CloudFront modifications. Since etag is a computed attribute that Terraform cannot modify, this provides a practical way to reduce plan noise while still tracking actual configuration changes. The default value of false ensures backward compatibility.

variables.tf (1)

752-756: LGTM! Variable definition follows best practices.

The new boolean variable is properly defined with an appropriate default of false to maintain backward compatibility. The description clearly explains the use case for ignoring CloudFront distribution etag changes caused by external modifications.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify bot added the triage Needs triage label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant