Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monitoring_role_arn for "aws_db_instance" "this_mssql" resource calculates empty value and generates error in case monitoring_interval > 0 #242

Closed
yxycman opened this issue Jul 23, 2020 · 4 comments

Comments

@yxycman
Copy link

yxycman commented Jul 23, 2020

Terraform: 0.12.25
AWS_provider: 2.70.0
module version: 2.15.0, 2.17.0

During creation of MSSQL backed RDS instance, i am getting the following error:
Error: Error modifying DB Instance db-host: InvalidParameterCombination: A MonitoringRoleARN value is required if you specify a MonitoringInterval value other than 0
as a result of the following interpolation:
var.monitoring_interval > 0 ? coalesce(var.monitoring_role_arn, aws_iam_role.enhanced_monitoring.*.arn, null) : null

For the "aws_db_instance" "this" resource in the same file, monitoring_role_arn is calculated with slightly different interpolation and, if i apply it to resource in question everything works fine
var.monitoring_interval > 0 ? coalesce(var.monitoring_role_arn, join(", ", aws_iam_role.enhanced_monitoring.*.arn), null) : null

looks like the cause is the type of the aws_iam_role.enhanced_monitoring.*.arn item, which is a list and a behavior of the coalesce function in case, more than two arguments provided.

> coalesce("", ["atata", "aaaa"], null)

> coalesce("", join(",", ["atata", "aaaa"]), null)
atata,aaaa
> coalesce("", ["atata", "aaaa"])

>
Error: Error in function call

  on <console-input> line 1:
  (source code not available)

Call to function "coalesce" failed: all arguments must have the same type.

Calling module with:

module "rds" {
  source                              = "terraform-aws-modules/rds/aws"
  version                             = "2.17.0"
  identifier                          = var.identifier
  engine                              = "sqlserver-se"
...
  create_monitoring_role             = true
  monitoring_interval                   = 60
...
}

https://github.com/terraform-aws-modules/terraform-aws-rds/blob/v2.17.0/modules/db_instance/main.tf#L151

@ghost
Copy link

ghost commented Oct 5, 2020

Is there any update on the above, looks like version 2.18.0 still has this issue.

Error: Error creating DB Instance: InvalidParameterCombination: A MonitoringRoleARN value is required if you specify a MonitoringInterval value other than 0. [2020-10-05T06:43:47.049Z] status code: 400, request id: 8ad86abc-428f-458e-a84f-8d9a0e631094

@mpardej
Copy link

mpardej commented Mar 15, 2021

Getting the same error. Is there any update?

@bryantbiggs
Copy link
Member

Closed with #318

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants