Update cloudwatch log group using terraform

2.6k views Asked by At

i am having issues updating existing aws cloudwatch log group which were created manually using console. I am using data source to pull the information of the cloudwatch log groups and trying to update the retention period. But getting following error

data "aws_cloudwatch_log_groups" "integration_logs" {
log_group_name_prefix = "/aws/rds/instance/product"
}

resource "aws_cloudwatch_log_group" "intergration_logs" {
name              = data.aws_cloudwatch_log_groups.integration_logs.log_group_names
retention_in_days = "731"

}

Error

 resource "aws_cloudwatch_log_group" "intergration_logs":
 494:   name              = data.aws_cloudwatch_log_groups.integration_logs.log_group_names
├────────────────
│ data.aws_cloudwatch_log_groups.integration_logs.log_group_names is set of string with 4 
elements

Inappropriate value for attribute "name": string required.

We have 4 log groups, so its bringing the correct information, but i am not sure what i am missing here

0

There are 0 answers