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).
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group#argument-reference
None
Voting for Prioritization
Volunteering to Work on This Issue