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

Added the output instance_class #111

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

Faris96Hub
Copy link
Contributor

what

Added the output instance_class

why

Needed for monitoring reasons. Enables you to set the threshold of the CloudWatch alarm for FreeableMemory to a percentage value instead of Bytes. Because if you know the instance type, you know the RAM of it and you can set the threshold of the alarm to for example 70% of that. Unfortunately there is no data ressource to get the instance_class from otherwise (it gives just general information about available instance_classes)

references

Data Ressource: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/docdb_orderable_db_instance#:~:text=X%2DRay-,Data%20Source,-%3A%20aws_docdb_orderable_db_instance

Freeable Memory: https://docs.aws.amazon.com/documentdb/latest/developerguide/cloud_watch.html#cloud_watch-metrics_list:~:text=one%2Dminute%20period.-,FreeableMemory,-The%20amount%20of

Instance_classes: https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-classes.html#db-instance-class-specs

@Faris96Hub Faris96Hub requested review from a team as code owners September 25, 2024 14:46
@mergify mergify bot added the triage Needs triage label Sep 25, 2024
outputs.tf Outdated Show resolved Hide resolved
outputs.tf Outdated

output "instance_class" {
description = "The instance calss used by the DocumentDB Cluster. For more details, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-classes.html#db-instance-class-specs"
value = distinct([for instance in aws_docdb_cluster_instance.default : instance.instance_class])[0]
Copy link
Member

Choose a reason for hiding this comment

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

@Faris96Hub how is this different from var.instance_class? Or is not different and you're using the default of that value, so you need it as an output? If the latter... can we just output var.instance_class instead of adding this looping logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not using the default but using var.instance_class would be an option too, to avoid the loop. Ill change it

@goruha
Copy link
Member

goruha commented Sep 26, 2024

@Faris96Hub if we have input instance_class, why do you need the output?
That's the same value.

Copy link
Member

@goruha goruha left a comment

Choose a reason for hiding this comment

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

The changes looks useless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants