Policy Change Notice: Net-new resources/data sources will require use of AutoFlex instead of manually implemented flattening and expanding functions #38907
In order to simplify implementation and maintenance, net-new resources should use AutoFlex, i.e. the functions flex.Flatten and flex.Expand instead of individually flattening and expanding fields between provider models and AWS API structures.
Note: This does not apply to enhancements and bug fixes to existing resources and data sources. Nor does it apply when converting resources or data sources from Terraform Plugin SDK v2 to Terraform Plugin Framework.
AutoFlex is expected to handle any conversions to and from Terraform attributes to AWS API structs. If you encounter a situation where conversion does not work, please file a GitHub issue. Enable AutoFlex logging by setting the environment variable TF_LOG_AWS_AUTOFLEX to TRACE and include the log in your issue.
The effective date of this change will be dictated by the following being completed:
[x] Documentation is updated to reflect use of AutoFlex
[x] Our templating tool (skaff) should be updated to use AutoFlex #39056
[x] Semgrep rules are added to discourage manually-created flexer functions #39101
Maintainer update
As of 5 September 2024, this policy is in effect. Existing pull requests do not need to be re-written to use AutoFlex. Where applicable maintainers will assist in changing these libraries. Enhancements and bug fixes do not require updating existing resources to use AutoFlex. This change only applies to net-new resources and data sources.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Description
In order to simplify implementation and maintenance, net-new resources should use AutoFlex, i.e. the functions
flex.Flatten
andflex.Expand
instead of individually flattening and expanding fields between provider models and AWS API structures.Documentation can be found at https://hashicorp.github.io/terraform-provider-aws/data-handling-and-conversion/#autoflex-for-terraform-plugin-framework-preferred.
Note: This does not apply to enhancements and bug fixes to existing resources and data sources. Nor does it apply when converting resources or data sources from Terraform Plugin SDK v2 to Terraform Plugin Framework.
AutoFlex is expected to handle any conversions to and from Terraform attributes to AWS API structs. If you encounter a situation where conversion does not work, please file a GitHub issue. Enable AutoFlex logging by setting the environment variable
TF_LOG_AWS_AUTOFLEX
toTRACE
and include the log in your issue.The effective date of this change will be dictated by the following being completed:
Maintainer update
As of 5 September 2024, this policy is in effect. Existing pull requests do not need to be re-written to use AutoFlex. Where applicable maintainers will assist in changing these libraries. Enhancements and bug fixes do not require updating existing resources to use AutoFlex. This change only applies to net-new resources and data sources.