Skip to content

Commit

Permalink
Add Performance Insights settings (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
aknysh authored Jan 9, 2019
1 parent 0933246 commit 5248aa1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017-2018 Cloud Posse, LLC
Copyright 2017-2019 Cloud Posse, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ Available targets:
| maintenance_window | Weekly time range during which system maintenance can occur, in UTC | string | `wed:03:00-wed:04:00` | no |
| name | Name of the application | string | - | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes |
| performance_insights_enabled | Whether to enable Performance Insights | string | `false` | no |
| performance_insights_kms_key_id | The ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true | string | `` | no |
| publicly_accessible | Set to true if you want your cluster to be publicly accessible (such as via QuickSight) | string | `false` | no |
| rds_monitoring_interval | Interval in seconds that metrics are collected, 0 to disable (values can only be 0, 1, 5, 10, 15, 30, 60) | string | `0` | no |
| rds_monitoring_role_arn | The ARN for the IAM role that can send monitoring metrics to CloudWatch Logs | string | `` | no |
Expand Down
2 changes: 2 additions & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
| maintenance_window | Weekly time range during which system maintenance can occur, in UTC | string | `wed:03:00-wed:04:00` | no |
| name | Name of the application | string | - | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes |
| performance_insights_enabled | Whether to enable Performance Insights | string | `false` | no |
| performance_insights_kms_key_id | The ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true | string | `` | no |
| publicly_accessible | Set to true if you want your cluster to be publicly accessible (such as via QuickSight) | string | `false` | no |
| rds_monitoring_interval | Interval in seconds that metrics are collected, 0 to disable (values can only be 0, 1, 5, 10, 15, 30, 60) | string | `0` | no |
| rds_monitoring_role_arn | The ARN for the IAM role that can send monitoring metrics to CloudWatch Logs | string | `` | no |
Expand Down
26 changes: 14 additions & 12 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,20 @@ resource "aws_rds_cluster" "default" {
}

resource "aws_rds_cluster_instance" "default" {
count = "${var.enabled == "true" ? var.cluster_size : 0}"
identifier = "${module.label.id}-${count.index+1}"
cluster_identifier = "${aws_rds_cluster.default.id}"
instance_class = "${var.instance_type}"
db_subnet_group_name = "${aws_db_subnet_group.default.name}"
db_parameter_group_name = "${aws_db_parameter_group.default.name}"
publicly_accessible = "${var.publicly_accessible}"
tags = "${module.label.tags}"
engine = "${var.engine}"
engine_version = "${var.engine_version}"
monitoring_interval = "${var.rds_monitoring_interval}"
monitoring_role_arn = "${var.rds_monitoring_role_arn}"
count = "${var.enabled == "true" ? var.cluster_size : 0}"
identifier = "${module.label.id}-${count.index+1}"
cluster_identifier = "${aws_rds_cluster.default.id}"
instance_class = "${var.instance_type}"
db_subnet_group_name = "${aws_db_subnet_group.default.name}"
db_parameter_group_name = "${aws_db_parameter_group.default.name}"
publicly_accessible = "${var.publicly_accessible}"
tags = "${module.label.tags}"
engine = "${var.engine}"
engine_version = "${var.engine_version}"
monitoring_interval = "${var.rds_monitoring_interval}"
monitoring_role_arn = "${var.rds_monitoring_role_arn}"
performance_insights_enabled = "${var.performance_insights_enabled}"
performance_insights_kms_key_id = "${var.performance_insights_kms_key_id}"
}

resource "aws_db_subnet_group" "default" {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,15 @@ variable "replication_source_identifier" {
description = "ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica"
default = ""
}

variable "performance_insights_enabled" {
type = "string"
default = "false"
description = "Whether to enable Performance Insights"
}

variable "performance_insights_kms_key_id" {
type = "string"
default = ""
description = "The ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true"
}

0 comments on commit 5248aa1

Please sign in to comment.