Skip to content

Commit

Permalink
Merge pull request #32 from azavea/feature/jrb/fix-monitoring-interval
Browse files Browse the repository at this point in the history
Only set monitoring_role_arn if monitoring_interval > 0
  • Loading branch information
rbreslow authored Feb 17, 2019
2 parents 385b871 + dcfc8bd commit c18a083
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`

2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c18a083

Please sign in to comment.