I've been adding KMS to all my resources and wondered why Terraform couldn't find the KMS key for the cloudwatch log group. Checked the code multiple times, tried adding a "depends_on" (maybe the dependency resolution broke?), tried changing policies and finally decided to read the docs again:

kms_key_id - (Optional) The ARN of the KMS Key to use when encrypting log data.

This resulted in the following code (with some small changes):

resource "aws_cloudwatch_log_group" "my_log_group" {
  name              = "my-wonderful-log-group"
  retention_in_days = 14
  kms_key_id        = aws_kms_key.encryption_key.arn

Could we please rename the kms_key_id argument to kms_key_arn in order to have consistent arguments? Maybe adding an alias and deprecating the old one is feasible in this case? This issue doesn't only affect CW, but some other resources - some of them supposedly support both formats.

If I miss something specific about the terminology of KMS, please let me know :)

PS: Sorry if I chose the wrong template, couldn't decide between bug, enhancement and docs (which are correct tho, just a little bit confusing).


Would you like to implement a fix?



Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.
© 2022 - All rights reserved.