Skip to content

docs/cloudfront_realtime_log_config: document cf.logCustomData() log fields - #49177

Merged
ewbankkit merged 2 commits into
hashicorp:mainfrom
arditti:f-cloudfront-log-custom-data-fields
Jul 29, 2026
Merged

docs/cloudfront_realtime_log_config: document cf.logCustomData() log fields#49177
ewbankkit merged 2 commits into
hashicorp:mainfrom
arditti:f-cloudfront-log-custom-data-fields

Conversation

@arditti

@arditti arditti commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

No. This change is limited to website documentation and one acceptance test.

Description

CloudFront Functions gained a cf.logCustomData() helper method on 2026-07-14. A viewer request or viewer response function calls it to write a string into the access log record for that request, surfaced in two new log fields, viewer-request-log-data and viewer-response-log-data. Both are available to real-time log configurations and to standard logging (v2).

Neither field needs a schema change. aws_cloudfront_realtime_log_config.fields is an unvalidated TypeSet of TypeString, and aws_cloudwatch_log_delivery.record_fields constrains only list size (0–128) and per-element length (1–64), which the 23- and 24-character names clear. Both already accept the new names; what was missing was documentation saying so and an example of the end-to-end pattern.

  • website/docs/r/cloudfront_realtime_log_config.html.markdown — put the existing example under a Basic Usage heading and added a Logging Custom Data From a CloudFront Function example pairing an aws_cloudfront_function that calls cf.logCustomData() with a log configuration that selects both fields, plus a note on wiring the cache behavior via function_association and realtime_log_config_arn. Extended the fields argument description.
  • website/docs/r/cloudwatch_log_delivery.html.markdown — added a CloudFront Standard Logging (v2) example covering the delivery source → destination → delivery chain with both fields in record_fields. Since there is no first-class distribution-level standard logging (v2) resource yet (Add support for CloudFront Standard Logging (v2) to CloudWatch Logs #44832), this page is where CloudFront users land. The record_fields description now notes that valid field names vary by the source's log_type and links the CloudFront field reference.
  • website/docs/r/cloudwatch_log_delivery_source.html.markdown — added CloudFront's ACCESS_LOGS to the log_type enumeration, which listed the other services but not CloudFront.
  • internal/service/cloudfront/realtime_log_config_test.go — added TestAccCloudFrontRealtimeLogConfig_functionLogData, covering a configuration whose fields set contains both new names, with an import verification step.

No changelog entry: per docs/changelog-process.md, documentation updates and testing updates are both listed under changes that should not have one.

Relations

Closes #49176

References

Output from Acceptance Testing

The new acceptance test has not been run — no AWS credentials for a suitable non-shared account were available in the environment this was prepared in. It provisions a Kinesis stream, an IAM role and policy, and a real-time log configuration. Local verification covers build, vet, format and test compilation:

% go build ./internal/service/cloudfront/ ./internal/service/logs/
% gofmt -l internal/service/cloudfront/ internal/service/logs/
% go vet ./internal/service/cloudfront/ ./internal/service/logs/
% go test -run 'xxNoSuchTestxx' ./internal/service/cloudfront/ ./internal/service/logs/
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 9.340s [no tests to run]
ok      github.com/hashicorp/terraform-provider-aws/internal/service/logs       8.952s [no tests to run]
% terrafmt diff ./website --check --pattern '*.markdown'

Eitav Arditti added 2 commits July 29, 2026 02:25
…fields

CloudFront Functions can write custom data into the access log record for a
request via the cf.logCustomData() helper method, surfaced in the
viewer-request-log-data and viewer-response-log-data log fields.

Both the real-time log config 'fields' set and the CloudWatch Logs delivery
'record_fields' list already accept these names (neither validates against a
fixed field list), so no schema change is needed. Document them, add an
end-to-end example pairing a CloudFront Function with a real-time log config,
add a CloudFront standard logging (v2) example to the delivery chain docs, and
cover the new fields with an acceptance test.
@arditti
arditti requested a review from a team as a code owner July 29, 2026 12:28
@github-actions

Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/logs Issues and PRs that pertain to the logs service. size/M Managed by automation to categorize the size of a PR. partner Contribution from a partner. labels Jul 29, 2026
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jul 29, 2026

@ewbankkit ewbankkit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀.

@ewbankkit

Copy link
Copy Markdown
Contributor

@arditti Thanks for the contribution 🎉 👏.

@ewbankkit
ewbankkit merged commit 92b56b3 into hashicorp:main Jul 29, 2026
52 of 54 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions Bot added this to the v6.57.1 milestone Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Introduces or discusses updates to documentation. partner Contribution from a partner. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/logs Issues and PRs that pertain to the logs service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: document CloudFront viewer-request-log-data / viewer-response-log-data log fields

2 participants