_This issue was originally opened by @bcavarun as hashicorp/terraform#16568. It was migrated here as a result of the provider split. The original body of the issue is below._
Hi there,
0.9.5
resource "aws_iam_role" "rds-enhanced-monitoring-role" {
name = "-rds-monitoring-role"
assume_role_policy = <
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "monitoring.rds.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}
resource "aws_iam_role_policy" "rds-enhanced-monitoring-policy" {
depends_on = ["aws_iam_role.rds-enhanced-monitoring-role"]
name = "enhanced-monitoring-attachment"
role = "${aws_iam_role.rds-enhanced-monitoring-role.name}"
policy = <
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableCreationAndManagementOfRDSCloudwatchLogGroups",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:PutRetentionPolicy"
],
"Resource": [
"arn:aws:logs:::log-group:RDS"
]
},
{
"Sid": "EnableCreationAndManagementOfRDSCloudwatchLogStreams",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams",
"logs:GetLogEvents"
],
"Resource": [
"arn:aws:logs:::log-group:RDS:log-stream:*"
]
}
]
}
EOF
}

Database should have got Enhanced Monitoring turned on.
It threw error that Role Value is required but the role got created in AWS and I am able to attach that role using AWS Console.
Please list the full steps required to reproduce the issue, for example:
If I create a fresh database, it works fine. but if I try to attach monitoring role on an existing database, I get the above mentioned error
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Value of monitoring_interval and monitoring_role_arn in terraform.tfstate file
"monitoring_interval": "10",
"monitoring_role_arn": "arn:aws:iam::<AWS_ACCOUNT_NO>:role/rds-monitoring-role",
Above role is created in AWS and I am able to attach it to db by AWS console.
But when I am trying using terraform it gives following error
`Error applying plan:
1 error(s) occurred:
aws_db_instance.rds_db_instance: 1 error(s) occurred:
aws_db_instance.rds_db_instance: Error modifying DB Instance maria-db: InvalidParameterCombination: A MonitoringRoleARN value is required if you specify a MonitoringInterval value other than 0.
status code: 400, request id: bad65ae0-8de3-42aa
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
`
I'm having the same issue at the moment.
The fix for this has been merged and will release in version 2.25.0 of the Terraform AWS Provider, in about a week.
This has been released in version 2.25.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
I'm having the same issue at the moment.