Skip to content

replace TLSv1.2_2019 with TLSv1.2_2021 as default policy #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 31, 2025

Conversation

jamerply
Copy link
Contributor

@jamerply jamerply commented Jan 9, 2024

what

This PR updates the mimimum_protocol_version variable so that it defaults to TLSv1.2_2021 (the current recommended security policy recommended by AWS) instead of TLSv1.2_2019.

why

The most current security policy is no longer TLSv1.2_2019 but is TLSv1.2_2021.

references

See the "Security Policy" heading under the "Distribution Setting" section of the AWS CloudFront Documentation for further information.

@jamerply jamerply requested review from a team as code owners January 9, 2024 19:41
@hans-d hans-d added wip Work in Progress: Not ready for final review or merge and removed wip Work in Progress: Not ready for final review or merge labels Mar 2, 2024
@hans-d
Copy link

hans-d commented Mar 2, 2024

/terratest

Copy link

mergify bot commented Mar 9, 2024

Thanks @jamerply for creating this pull request!

A maintainer will review your changes shortly. Please don't be discouraged if it takes a while.

While you wait, make sure to review our contributor guidelines.

Tip

Need help or want to ask for a PR review to be expedited?

Join us on Slack in the #pr-reviews channel.

@mergify mergify bot added the triage Needs triage label Mar 9, 2024
Nuru
Nuru previously requested changes Mar 25, 2024
Copy link
Contributor

@Nuru Nuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, this is a potentially breaking change that will manifest as some old clients failing to connect all of a sudden, a problem which will be difficult to trace back to updating this component.

I think instead we should just recommend that users explicitly set this to the newer version.

@jamerply
Copy link
Contributor Author

@Nuru

The problem is, this is a potentially breaking change that will manifest as some old clients failing to connect all of a sudden, a problem which will be difficult to trace back to updating this component.

If users have pinned their modules to a particular version per CloudPosse's own recommendation, wouldn't that prevent the breaking change unless they knowingly updated to the newer version?

@Gowiem
Copy link
Member

Gowiem commented May 10, 2024

@Nuru thoughts on just making this a major revision change? I agree that we should upgrade this for future consumers of this module, otherwise we're encouraging an old and outdated TLS. The other route is to remove the default altogether, but either way we'll want to do a major version rev. Let me know your thoughts and I can work with @jamerply to push this forward.

Copy link
Contributor

@oycyc oycyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just came across this, think this would be good to have as default as it's officially recommended both on the docs (as the PR noted) and on the AWS console. I think a major bump would make sense in terms of @Nuru's concern about the potentially breaking change and backwards compatbility
image

Copy link

mergify bot commented May 7, 2025

💥 This pull request now has conflicts. Could you fix it @jamerply? 🙏

@mergify mergify bot added the conflict This PR has conflicts label May 7, 2025
Copy link

coderabbitai bot commented May 7, 2025

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

The changes update the default TLS protocol version for CloudFront in both documentation and Terraform configuration files. The default for minimum_protocol_version is changed from "TLSv1.2_2019" to "TLSv1.2_2021" when a custom ACM certificate is provided. No logic or variable signatures are altered; only defaults and documentation are updated.

Changes

Files Change Summary
docs/terraform.md, variables.tf Updated documentation and variable description to reflect the new default value "TLSv1.2_2021" for minimum_protocol_version when acm_certificate_arn is set. No changes to types or signatures.
main.tf Changed the default value in the conditional logic for minimum_protocol_version from "TLSv1.2_2019" to "TLSv1.2_2021" when a custom ACM certificate is used. No other logic changes.

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
variables.tf (1)

13-22: Add validation to restrict protocol version values.

Consider adding a validation block to enforce that var.minimum_protocol_version can only be "", "TLSv1", or one of the supported TLSv1.2_* versions to prevent typos or unsupported values.

 variable "minimum_protocol_version" {
   type        = string
   description = <<-EOT
     Cloudfront TLS minimum protocol version.
     If `var.acm_certificate_arn` is unset, only "TLSv1" can be specified. See: ...
     Defaults to "TLSv1.2_2021" unless `var.acm_certificate_arn` is unset, in which case it defaults to `TLSv1`
   EOT
   default     = ""
+  validation {
+    condition     = var.minimum_protocol_version == "" ||
+                     contains(["TLSv1","TLSv1.2_2019","TLSv1.2_2021"], var.minimum_protocol_version)
+    error_message = "minimum_protocol_version must be one of \"TLSv1\", \"TLSv1.2_2019\", or \"TLSv1.2_2021\""
+  }
 }
main.tf (1)

55-57: Verify default TLS logic and handle breaking change.

The logic now defaults to "TLSv1.2_2021" when a custom ACM certificate is provided, and "TLSv1" otherwise, aligning with AWS recommendations. Since this may break compatibility for older clients, please ensure you communicate this change clearly (e.g., via a major version bump and changelog entry).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3b5145 and 6ddaa3c.

⛔ Files ignored due to path filters (1)
  • README.md is excluded by !README.md
📒 Files selected for processing (3)
  • docs/terraform.md (1 hunks)
  • main.tf (1 hunks)
  • variables.tf (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (2)
variables.tf (1)

19-20: Update variable description for TLS default version.

The description now correctly states the new default of TLSv1.2_2021 when an ACM certificate ARN is provided, and TLSv1 otherwise. This aligns with the change in CloudFront’s recommended security policy.

docs/terraform.md (1)

128-129: Update documentation to reflect new default TLS protocol.

This entry now correctly documents the default as "TLSv1.2_2021" when an ACM certificate is provided and "TLSv1" otherwise, matching the code changes in the module.

🧰 Tools
🪛 LanguageTool

[typographical] ~129-~129: Consider adding a comma after ‘Usually’ for more clarity.
Context: ... name | ID element. Usually the component or solution name, e.g. 'a...

(RB_LY_COMMA)


[uncategorized] ~129-~129: Possible missing preposition found.
Context: ...ID element not also included as a tag.
The "name" tag is set to the full id s...

(AI_EN_LECTOR_MISSING_PREPOSITION)

@Gowiem
Copy link
Member

Gowiem commented May 7, 2025

/terratest

@mergify mergify bot removed the conflict This PR has conflicts label May 7, 2025
@Gowiem Gowiem added enhancement New feature or request major Breaking changes (or first stable release) and removed triage Needs triage labels May 7, 2025
@Gowiem Gowiem requested a review from Nuru May 7, 2025 16:01
@Gowiem
Copy link
Member

Gowiem commented May 7, 2025

/terratest

@Gowiem
Copy link
Member

Gowiem commented May 7, 2025

@oycyc agreed. I'm taking this internally to the Cloud Posse folks and asking for another review so that we move this forward. Thanks for reviving this PR with your comment 👍

Sadly, we also have a test failure here:

Run actions/setup-go@v5
/usr/bin/docker exec  e7aa506c37134f9795e46a4b5a510bca1ca734535914bf1bc0524a7ae95bfa85 sh -c "cat /etc/*release | grep ^ID"
Setup go version spec 1.20
Attempting to download 1.20...
matching 1.20...
Acquiring 1.20.14 from https://github.com/actions/go-versions/releases/download/1.20.14-7809684997/go-1.20.14-linux-x64.tar.gz
Extracting Go...
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /__w/_temp/5bc893cc-6754-4680-98e6-09dba2742765 -f /__w/_temp/248d[17](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn/actions/runs/14887918312/job/41812431151#step:13:18)bd-d695-4470-9221-f2c3548b1ccb
Successfully extracted go to /__w/_temp/5bc893cc-6754-4680-98e6-09dba2742765
Adding to the cache ...
Successfully cached go to /__t/go/1.[20](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn/actions/runs/14887918312/job/41812431151#step:13:21).14/x64
Added go to the path
Successfully set up Go version 1.20
Error loading shared library libresolv.so.2: No such file or directory (needed by /__t/go/1.20.14/x64/bin/go)
Error: Command failed: go env GOPATH
Error loading shared library libresolv.so.2: No such file or directory (needed by /__t/go/1.20.14/x64/bin/go)

I'll ask if we've seen that before.

@Nuru
Copy link
Contributor

Nuru commented May 7, 2025

@Gowiem Regarding the Golang tests, see golang/go#59305 (comment)

@oycyc The problem with upgrades is that people are using automated tools to upgrade to new versions. This module has not matured to v1.0 semantic versioning, and v0 versioning works differently. That makes this upgrade a bigger deal, and IMHO the gain is not worth it.

This is not the end of the discussion, but my leaning at the moment is toward just having a documentation update recommending people set the TLS version to the latest version explicitly. We can update the default when we get to v2 (which may not be for a long time).

This was referenced Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants