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

Only set monitoring_role_arn if monitoring_interval > 0 #32

Merged
merged 4 commits into from
Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 terraform-providers/terraform-provider-aws#315.
rbreslow marked this conversation as resolved.
Show resolved Hide resolved

## 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