-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Upgrade to be terraform .12 compatible & other changes #21
Conversation
That is going to break other modules, could it be possible for you to use
to the topics so that if there is no thanks |
@jamengual Yeah, that should be possible. But either way the PR will still have a breaking change with the db instance id param. I'm going to wait for a maintainer to respond to see what changes would be necessary to merge this in. |
for the breaking changes I think is possible to maybe leave them empty or use a dynamic. |
To make this easier to review, could you put these changes in separate PRs? We should at the very least have a separate PR for terraform11 to terraform12 changes to make this easier to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @caleb15 ! Thank you very much for PR.
These are great changes. I'm in favour of removing SNS topic creation without any backward compatibility. It should be fairly easy to migrate to new version thanks to variable aws_sns_topic_arn
. In @cloudposse/contributors we are working on SNS module (initial PR already pushed) that should be used in conjunction with any CloudWatch alarm module.
Additionally it's a good change to monitor multiple RDS instances with this single module. We can avoid backward incompatibilty by reducing readablity of code and by having tech debt. Let's avoid that.
I left couple of questions and few improvements.
PS: I'm going to push pre-commit
to this repo for tf fmt
and other lints. Please merge it to your PR when it's done.
|
||
source_type = "db-instance" | ||
source_ids = ["${var.db_instance_id}"] | ||
source_ids = var.db_instance_ids | ||
|
||
event_categories = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason behind removing other categories?
I think it would be best to preserve previous list as a default. To customize you can create event_categories
variable of list(string)
type.
default = 64 | ||
} | ||
|
||
variable "freeable_memory_threshold" { | ||
description = "The minimum amount of available random access memory in Byte." | ||
type = "string" | ||
type = string | ||
default = 64000000 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
resource "aws_sns_topic" "default" { | ||
name_prefix = "rds-threshold-alerts" | ||
} | ||
|
||
resource "aws_db_event_subscription" "default" { | ||
name_prefix = "rds-event-sub" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely we need a name prefix so all resources with names created by this module are aligned. Additionally I think rds-sns-alarms
is more telling.
name_prefix = "rds-event-sub" | |
name_prefix = "${var.name_prefix}rds-sns-alarms" |
} | ||
|
||
variable "aws_sns_topic_arn" { | ||
description = "The bla of the SNS topic you want to use for alerting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The bla"? I guess you mean ARN
metric_name = "BurstBalance" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
period = var.period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit = "Percent"
metric_name = "DiskQueueDepth" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
period = var.period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit = "Count"
metric_name = "FreeableMemory" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
period = var.period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit = "Bytes"
metric_name = "FreeStorageSpace" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
period = var.period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit = "Bytes"
metric_name = "SwapUsage" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
period = var.period |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit = "Bytes"
alarms.tf
Outdated
alarm_actions = ["${aws_sns_topic.default.arn}"] | ||
ok_actions = ["${aws_sns_topic.default.arn}"] | ||
threshold = local.thresholds["BurstBalanceThreshold"] | ||
alarm_description = "Average database storage burst balance over last ${var.period/60} minutes too low, expect a significant performance drop soon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add db_instance_id
to every alarm_description.
Sorry for the delay on responding to the PR review, I've created a ticket so I remember to get to it eventually. It might be a while. Thanks for the review! |
@caleb15 Any chance we might see an update :)? |
@macnibblet yes, but it may take a while 🙈 I have the email starred in my inbox along with 30 others. |
We only need failure event because we only know for sure that the user wants to be informed of a failure. Other events a user might not care about. Also there is already alarm for low storage.
this module is just for alarms we know it applies to alarms already so no need to state it
* Added rapid increase space alert * add rds free storage space alert * fix alarm variable value * add anomoly detection metric query Co-authored-by: jamesjsanders <[email protected]>
remove validate - it doesn't work
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why all this have to be deleted?
Added datapoints_to_alarm requirement to free-storage alarm
needs set for for_each to work
@caleb15 how far are you from finishing this one up? |
Also waiting for this PR to be merged, to stop using a fork of this repo! |
@maximmi are you still the owning migration to 0.12 PRs? Any chance you could check this one out? |
Tf.13 update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caleb15 thank you for contribution
we have our standards for Terraform 0.12+ code, so that tests and github workflows should be in place. It might be hard to implement such things by you, so I will try to update your PR to respect all requirements.
For the reference you could pick any our repo with terraform 0.12+ support, for example: https://github.com/cloudposse/terraform-aws-s3-bucket
This pull request is now in conflict. Could you fix it @caleb15? 🙏 |
db_instance_id
changed todb_instance_ids
to support multiple db'salarm_period
andalarm_evaluation_periods
paramsWe are running this change in production for 15Five.