terraform-aws-cloudfront-s3-cdn icon indicating copy to clipboard operation
terraform-aws-cloudfront-s3-cdn copied to clipboard

feat: Backport cloudposse/cloudfront-cdn/aws improvements

Open jwadolowski opened this issue 6 months ago โ€ข 3 comments

what

TBD

why

references

jwadolowski avatar Jun 03 '25 14:06 jwadolowski

[!IMPORTANT]

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

๐Ÿ“ Walkthrough

Walkthrough

This update introduces a new minimal example configuration and its associated variable file, revises the main Terraform logic to consolidate and simplify CORS and CloudFront origin configuration, and overhauls the input variable schema to favor optional fields with defaults, adds new timeout and origin shield options, and removes a deprecated variable.

Changes

Cohort / File(s) Change Summary
New Minimal Example
examples/complete/minimal.tf, examples/complete/minimal.us-east-2.tfvars
Adds a minimal Terraform example and a corresponding variable file for the us-east-2 region, demonstrating basic module usage with access logging disabled and specifying core deployment parameters.
Main Logic & Resource Configuration
main.tf
Refactors resource logic to use a consolidated CORS origins local, replaces lookup() with direct attribute access, adds origin timeout and dynamic origin shield support, and simplifies conditional expressions for origins and error responses.
Input Variable Schema Overhaul
variables.tf
Makes many input variables optional with sensible defaults, introduces new variables for origin timeouts and origin shield, and removes the versioning_enabled variable, altering the module's input schema and flexibility.

Estimated code review effort

๐ŸŽฏ 3 (Moderate) | โฑ๏ธ ~15โ€“20 minutes

Possibly related PRs

  • cloudposse/terraform-aws-cloudfront-s3-cdn#326: Adds origin_access_control_id to custom_origins and updates its usage, which is directly extended and refined in this PR through further logic and schema changes for origin access control.
โœจ Finishing Touches
๐Ÿงช Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jun 03 '25 14:06 coderabbitai[bot]

๐Ÿ’ฅ This pull request now has conflicts. Could you fix it @jwadolowski? ๐Ÿ™

mergify[bot] avatar Jun 03 '25 14:06 mergify[bot]

๐Ÿ’ฅ This pull request now has conflicts. Could you fix it @jwadolowski? ๐Ÿ™

mergify[bot] avatar Jun 06 '25 19:06 mergify[bot]

@johncblandii @Gowiem can we start the tests on this please?

mihaiplesa avatar Aug 01 '25 14:08 mihaiplesa

/terratest

goruha avatar Aug 08 '25 06:08 goruha

All tests failed due to BucketAlreadyExists errors. Since S3 bucket names must be globally unique, we should use dynamically generated names during testing.

jwadolowski avatar Aug 08 '25 16:08 jwadolowski

[!IMPORTANT]

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

mergify[bot] avatar Aug 10 '25 16:08 mergify[bot]

It turned out that the 2nd module instance I added to minimal.tf resulted in an S3 bucket name collision. These changes should resolve the problem.

By the way, I modified both Makefiles to streamline local testing:

  • test/Makefile - just make (without any concrete targets) runs init automatically now (previously it had to be executed by hand to populate the test/.test-harness directory)
  • test/src/Makefile - the -get-plugins=true flag was removed in Terraform v0.15.0 (see CHANGELOG.md), so it doesn't make sense to reference it any longer

@goruha @johncblandii @Gowiem can you start the tests again, please?

jwadolowski avatar Aug 10 '25 16:08 jwadolowski

/terratest

goruha avatar Aug 11 '25 10:08 goruha

/terratest

goruha avatar Aug 11 '25 13:08 goruha

These changes were released in v1.0.0.

github-actions[bot] avatar Aug 11 '25 14:08 github-actions[bot]

These changes were released in v1.0.1.

github-actions[bot] avatar Sep 10 '25 17:09 github-actions[bot]