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

Conversation

rbreslow
Copy link
Contributor

Overview

  • Update main.tf
  • Add note about enhanced monitoring support to README.md

Fixes #31

Connects hashicorp/terraform-provider-aws#5559
Connects hashicorp/terraform-provider-aws#2188
Connects hashicorp/terraform-provider-aws#315

See: hashicorp/terraform-provider-aws#315 (comment)

Testing Instructions

I setup a local Terraform project and pointed the AWS backend to our R&D account.

Next, I created an instance of this module with a monitoring interval of 0:

module "database" {
  source = "github.com/azavea/terraform-aws-postgresql-rds?ref=d1706c3"

  vpc_id                     = "${module.vpc.id}"
  allocated_storage          = "${var.rds_allocated_storage}"
  engine_version             = "${var.rds_engine_version}"
  instance_type              = "${var.rds_instance_type}"
  storage_type               = "${var.rds_storage_type}"
  database_identifier        = "${var.rds_database_identifier}"
  database_name              = "${var.rds_database_name}"
  database_username          = "${var.rds_database_username}"
  database_password          = "${var.rds_database_password}"
  backup_retention_period    = "${var.rds_backup_retention_period}"
  backup_window              = "${var.rds_backup_window}"
  maintenance_window         = "${var.rds_maintenance_window}"
  auto_minor_version_upgrade = "${var.rds_auto_minor_version_upgrade}"
  final_snapshot_identifier  = "${var.rds_final_snapshot_identifier}"
  skip_final_snapshot        = "${var.rds_skip_final_snapshot}"
  copy_tags_to_snapshot      = "${var.rds_copy_tags_to_snapshot}"
  multi_availability_zone    = "${var.rds_multi_az}"
  storage_encrypted          = "${var.rds_storage_encrypted}"
  subnet_group               = "${aws_db_subnet_group.default.name}"
  parameter_group            = "${aws_db_parameter_group.default.name}"
  monitoring_interval        = "0"

  alarm_cpu_threshold                = "${var.rds_cpu_threshold_percent}"
  alarm_disk_queue_threshold         = "${var.rds_disk_queue_threshold}"
  alarm_free_disk_threshold          = "${var.rds_free_disk_threshold_bytes}"
  alarm_free_memory_threshold        = "${var.rds_free_memory_threshold_bytes}"
  alarm_cpu_credit_balance_threshold = "${var.rds_cpu_credit_balance_threshold}"
  alarm_actions                      = ["${aws_sns_topic.global.arn}"]
  ok_actions                         = ["${aws_sns_topic.global.arn}"]
  insufficient_data_actions          = ["${aws_sns_topic.global.arn}"]

  project     = "${var.project}"
  environment = "${var.environment}"
}

I confirmed in the AWS Console that the RDS instance came online with support for enhanced monitoring disabled.

I changed this value to 60, and cycled Terraform again:

...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ module.database.aws_db_instance.postgresql
      monitoring_interval: "0" => "60"
      monitoring_role_arn: "" => "arn:aws:iam::279682201306:role/rdsStagingEnhancedMonitoringRole"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.database.aws_db_instance.postgresql: Modifying... (ID: rockytesting)
  monitoring_interval: "0" => "60"
  monitoring_role_arn: "" => "arn:aws:iam::279682201306:role/rdsStagingEnhancedMonitoringRole"
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 10s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 20s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 30s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 40s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 50s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m0s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m10s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m20s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m30s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m40s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 1m50s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 2m0s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 2m10s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 2m20s elapsed)
module.database.aws_db_instance.postgresql: Still modifying... (ID: rockytesting, 2m30s elapsed)
module.database.aws_db_instance.postgresql: Modifications complete after 2m33s (ID: rockytesting)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

I confirmed in the AWS Console that the RDS instance came online with support for enhanced monitoring enabled.

* Update main.tf
* Add note about enhanced monitoring support to README.md
@rbreslow rbreslow self-assigned this Feb 15, 2019
@rbreslow rbreslow requested a review from hectcastro February 15, 2019 19:50
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@hectcastro hectcastro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice concise fix. 👍

README.md Outdated Show resolved Hide resolved
Co-Authored-By: rbreslow <[email protected]>
@rbreslow rbreslow merged commit c18a083 into develop Feb 17, 2019
@rbreslow rbreslow deleted the feature/jrb/fix-monitoring-interval branch February 17, 2019 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants