diff --git a/README.md b/README.md index c4ff65b..972c2e7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Terraform module to create an Amazon Web Services (AWS) PostgreSQL Relational ## Usage -```javascript +```hcl module "postgresql_rds" { source = "github.com/azavea/terraform-aws-postgresql-rds" vpc_id = "vpc-20f74844" @@ -40,6 +40,18 @@ module "postgresql_rds" { } ``` +### Note about Enhanced Monitoring support + +If the `monitoring_interval` passed as an input to this module is `0`, an empty `monitoring_role_arn` value will be threaded into the `aws_db_instance` resource. + +This is because, if a value for `monitoring_role_arn` is threaded into an `aws_db_instance`, along with a `monitoring_interval` of `0`, the following error will occur: + +```bash +InvalidParameterCombination: You must specify a MonitoringInterval value other than 0 when you specify a MonitoringRoleARN value. +``` + +If you're curious to know more, see the discussion within https://github.com/terraform-providers/terraform-provider-aws/issues/315. + ## Variables - `vpc_id` - ID of VPC meant to house database @@ -92,4 +104,3 @@ module "postgresql_rds" { - `endpoint` - Public DNS name and port separated by a `:` - `hosted_zone_id` - The zone id for the autogenerated DNS name given in `endpoint`. Use this when creating a short-name DNS [alias](https://www.terraform.io/docs/providers/aws/r/route53_record.html#alias-record) for the `endpoint` - diff --git a/main.tf b/main.tf index 654eb08..c0ab7b2 100644 --- a/main.tf +++ b/main.tf @@ -73,7 +73,7 @@ resource "aws_db_instance" "postgresql" { parameter_group_name = "${var.parameter_group}" storage_encrypted = "${var.storage_encrypted}" monitoring_interval = "${var.monitoring_interval}" - monitoring_role_arn = "${aws_iam_role.enhanced_monitoring.arn}" + monitoring_role_arn = "${var.monitoring_interval > 0 ? aws_iam_role.enhanced_monitoring.arn : ""}" tags { Name = "DatabaseServer"