PR is here
Shipped in Provider version 4.16.0.
Adding new server_timing_headers_config
configuration block for aws_cloudfront_response_headers_policy
resource.
It will allow us to configure Server Timing headers within Cloudfront.
AWS API and userguide docs refs:
- API_ResponseHeadersPolicyServerTimingHeadersConfig
- API_CreateResponseHeadersPolicy
- Response Headers Policies
- Creating Response Headers Policies
Lessons learned
Update both resource and data_source
If you are going to introduce some new attributes for AWS resource
it will be a good practice to also add the same attribute for
data_source
. This is useful as you will have the attribute populated for your data_source
when you are trying to just
read some already existing resources.
Please pay attention, that all the attributes you define for your data_source
MUST have Computed: true
defined for them:
Always try to follow AWS API (SDK) objects structure as much as possible
Based on AWS API docs and AWS SDK, Server Timing headers configuration object contains two fields:
From the first look it might appear to you that having Enabled
attribute is redundant as it does not make any sense to
set it to false - you can just remove Terraform configuration block for server timing headers config.
My first version of the code had an if
statement for doing this enablement/disablement:
However, after review Terraform Contribution guidelines I have figured out that it’s better to follow API object structure as much as possible.
That means, to have separate fields for enabled
and sampling_rate
:
Leave a comment