Skip to content

Commit

Permalink
terraform docs & versions.tf for every module
Browse files Browse the repository at this point in the history
  • Loading branch information
EreminAnton committed Aug 15, 2023
1 parent b43e684 commit 7c54812
Show file tree
Hide file tree
Showing 16 changed files with 381 additions and 17 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ repos:
- id: terraform_validate
- id: terraform_docs
- id: terraform_tfsec

19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,15 @@ Stay proactive and enhance your alerting system with the aws-alerts-to-slack Ter

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_budget_alerts"></a> [budget\_alerts](#module\_budget\_alerts) | ./modules/budget_alerts | n/a |
| <a name="module_chatbot_role"></a> [chatbot\_role](#module\_chatbot\_role) | ./modules/iam | n/a |
| <a name="module_chatbot_slack_workspace"></a> [chatbot\_slack\_workspace](#module\_chatbot\_slack\_workspace) | ./modules/slack_workspace | n/a |
| <a name="module_cost_anomaly_detection"></a> [cost\_anomaly\_detection](#module\_cost\_anomaly\_detection) | ./modules/cost_anomaly_detection | n/a |
| <a name="module_eventbridge_alerts"></a> [eventbridge\_alerts](#module\_eventbridge\_alerts) | ./modules/eventbridge | n/a |
| <a name="module_reservations_alerts"></a> [reservations\_alerts](#module\_reservations\_alerts) | ./modules/reservations | n/a |
| <a name="module_savings_plans_alerts"></a> [savings\_plans\_alerts](#module\_savings\_plans\_alerts) | ./modules/savings_plans | n/a |
No modules.

## Resources

| Name | Type |
|------|------|
| [aws_sns_topic.chatbot](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
| [aws_sns_topic_policy.chatbot_topic](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_policy) | resource |
No resources.

## Inputs

Expand Down
44 changes: 44 additions & 0 deletions modules/budget_alerts/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Standartized and simplified budget alert

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_budgets_budget.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_create"></a> [create](#input\_create) | (Optional) Controls if budget should be created. | `bool` | `true` | no |
| <a name="input_limit_amount"></a> [limit\_amount](#input\_limit\_amount) | (Required) The amount of cost or usage being measured for a budget. | `string` | n/a | yes |
| <a name="input_limit_unit"></a> [limit\_unit](#input\_limit\_unit) | (Optional) The unit of measurement used for the budget forecast, actual spend, or budget threshold, such as dollars or GB. | `string` | `"USD"` | no |
| <a name="input_name"></a> [name](#input\_name) | (Optional) The name of a budget. Unique within accounts. | `string` | `"cost-budget-alerts"` | no |
| <a name="input_notification_on_threshold_percentage"></a> [notification\_on\_threshold\_percentage](#input\_notification\_on\_threshold\_percentage) | (Optional) The percentage of the budget threshold to notify. With default values, notifications will be sent at 100%, 150%, and 200% of the budget `limit_amount`. | `list(number)` | <pre>[<br> 100,<br> 150,<br> 200<br>]</pre> | no |
| <a name="input_subscriber_email_addresses"></a> [subscriber\_email\_addresses](#input\_subscriber\_email\_addresses) | (Optional) E-Mail addresses to notify. Either this or subscriber\_sns\_topic\_arns is required. | `list(string)` | `[]` | no |
| <a name="input_subscriber_sns_topic_arns"></a> [subscriber\_sns\_topic\_arns](#input\_subscriber\_sns\_topic\_arns) | (Optional) SNS topics to notify. Either this or subscriber\_email\_addresses is required. | `list(string)` | `[]` | no |
| <a name="input_time_period_start"></a> [time\_period\_start](#input\_time\_period\_start) | (Optional) The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: 2023-01-01\_00:00. | `string` | `"2023-01-01_00:00"` | no |
| <a name="input_time_unit"></a> [time\_unit](#input\_time\_unit) | (Required) The length of time until a budget resets the actual and forecasted spend. Valid values: MONTHLY, QUARTERLY, ANNUALLY, and DAILY. | `string` | `"MONTHLY"` | no |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/budget_alerts/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
43 changes: 43 additions & 0 deletions modules/cost_anomaly_detection/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Cost anomaly detection alert


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_ce_anomaly_monitor.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ce_anomaly_monitor) | resource |
| [aws_ce_anomaly_subscription.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ce_anomaly_subscription) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_anomaly_monitor_name"></a> [anomaly\_monitor\_name](#input\_anomaly\_monitor\_name) | (Optional) The name of the anomaly monitor. | `string` | `"AWSServiceMonitor"` | no |
| <a name="input_anomaly_subscription_name"></a> [anomaly\_subscription\_name](#input\_anomaly\_subscription\_name) | (Optional) The name of the anomaly subscription. | `string` | `"AWSServiceSubscription"` | no |
| <a name="input_frequency"></a> [frequency](#input\_frequency) | (Optional) The frequency that anomaly reports are sent. Valid Values: DAILY \| IMMEDIATE \| WEEKLY.<br> Daily or weekly frequencies only support Email subscriptions<br> Immediate frequencies support a max of one subscriber | `string` | `"DAILY"` | no |
| <a name="input_subscriber_email_addresses"></a> [subscriber\_email\_addresses](#input\_subscriber\_email\_addresses) | (Optional) E-Mail addresses to notify. Either this or subscriber\_sns\_topic\_arns is required. | `list(string)` | `[]` | no |
| <a name="input_subscriber_sns_topic_arns"></a> [subscriber\_sns\_topic\_arns](#input\_subscriber\_sns\_topic\_arns) | (Optional) SNS topics to notify. Either this or subscriber\_email\_addresses is required. | `list(string)` | `[]` | no |
| <a name="input_threshold"></a> [threshold](#input\_threshold) | (Required) The dollar value that triggers a notification if the threshold is exceeded. | `string` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/cost_anomaly_detection/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
44 changes: 44 additions & 0 deletions modules/eventbridge/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Event brige alerts:
GuardDuty and AWS health events, both are can be disabled.


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_cloudwatch_event_rule.aws_health](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
| [aws_cloudwatch_event_rule.guardduty_findings](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
| [aws_cloudwatch_event_target.aws_health](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
| [aws_cloudwatch_event_target.guardduty_findings](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_create"></a> [create](#input\_create) | (Optional) Controls if the resources in this module should be created. | `bool` | `true` | no |
| <a name="input_create_aws_health_rule"></a> [create\_aws\_health\_rule](#input\_create\_aws\_health\_rule) | (Optional) Whether to create the AWS Health rule. | `bool` | `true` | no |
| <a name="input_create_guardduty_findings_rule"></a> [create\_guardduty\_findings\_rule](#input\_create\_guardduty\_findings\_rule) | (Optional) Whether to create the GuardDuty findings rule. | `bool` | `true` | no |
| <a name="input_sns_topic_arn"></a> [sns\_topic\_arn](#input\_sns\_topic\_arn) | (Required) The ARN of the SNS topic to send notifications to. | `string` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/eventbridge/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
41 changes: 41 additions & 0 deletions modules/iam/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Optional automated Iam for Chatbot


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_chatbot_notifications_only_policy"></a> [chatbot\_notifications\_only\_policy](#module\_chatbot\_notifications\_only\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | 5.28.0 |
| <a name="module_chatbot_role"></a> [chatbot\_role](#module\_chatbot\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | 5.28.0 |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_create_notifications_only_policy"></a> [create\_notifications\_only\_policy](#input\_create\_notifications\_only\_policy) | (Optional) Whether to create the AWS-Chatbot-NotificationsOnly-Policy policy. Defaults to true. | `bool` | `true` | no |
| <a name="input_create_role"></a> [create\_role](#input\_create\_role) | (Optional) Whether to create the AWSChatbot role. Defaults to true. | `bool` | `true` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | (Optional) A mapping of tags to assign to all resources. | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_iam_role_arn"></a> [iam\_role\_arn](#output\_iam\_role\_arn) | n/a |
| <a name="output_notifications_only_policy_arn"></a> [notifications\_only\_policy\_arn](#output\_notifications\_only\_policy\_arn) | n/a |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/iam/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
48 changes: 48 additions & 0 deletions modules/reservations/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Reservations utilization alert

Like in budget alerts, required only 2 values:
- `threshold` - percentage of utilization
- `subscriber_sns_topic_arns` - sns topic for chatbot


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_budgets_budget.reservations_utilization](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_create"></a> [create](#input\_create) | (Optional) Controls if budget should be created. | `bool` | `true` | no |
| <a name="input_name"></a> [name](#input\_name) | (Optional) The name of a budget. Unique within accounts. | `string` | `"ri-utilization-budget-alerts"` | no |
| <a name="input_services"></a> [services](#input\_services) | (Optional) List of services to send alerts for. Defaults to all services. | `list(string)` | <pre>[<br> "Amazon Elasticsearch Service",<br> "Amazon Relational Database Service",<br> "Amazon Redshift",<br> "Amazon Elastic Compute Cloud - Compute",<br> "Amazon ElastiCache",<br> "Amazon OpenSearch Service"<br>]</pre> | no |
| <a name="input_subscriber_email_addresses"></a> [subscriber\_email\_addresses](#input\_subscriber\_email\_addresses) | (Optional) E-Mail addresses to notify. Either this or subscriber\_sns\_topic\_arns is required. | `list(string)` | `[]` | no |
| <a name="input_subscriber_sns_topic_arns"></a> [subscriber\_sns\_topic\_arns](#input\_subscriber\_sns\_topic\_arns) | (Optional) SNS topics to notify. Either this or subscriber\_email\_addresses is required. | `list(string)` | `[]` | no |
| <a name="input_threshold"></a> [threshold](#input\_threshold) | (Optional) Threshold when the notification should be sent. | `number` | `90` | no |
| <a name="input_time_period_start"></a> [time\_period\_start](#input\_time\_period\_start) | (Optional) The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: 2023-01-01\_00:00. | `string` | `"2023-01-01_00:00"` | no |
| <a name="input_time_unit"></a> [time\_unit](#input\_time\_unit) | (Required) The length of time until a budget resets the actual and forecasted spend. Valid values: MONTHLY, QUARTERLY, ANNUALLY, and DAILY. | `string` | `"MONTHLY"` | no |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/reservations/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
46 changes: 46 additions & 0 deletions modules/savings_plans/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Savings plans utilization alert

Like in budget alerts, required only 2 values:
- `threshold` - percentage of utilization
- `subscriber_sns_topic_arns` - sns topic for chatbot


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_budgets_budget.savings_plan_utilization](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_budget_name"></a> [budget\_name](#input\_budget\_name) | (Optional) The name of the savings\_plans\_budget. Defaults to 'Savings Plans Utilization'. | `string` | `"Savings Plans Utilization"` | no |
| <a name="input_budget_time_period_start"></a> [budget\_time\_period\_start](#input\_budget\_time\_period\_start) | (Optional) The time\_period\_start of the alert. Defaults to '2023-01-01\_00:00'. | `string` | `"2023-01-01_00:00"` | no |
| <a name="input_create_utilization_alert"></a> [create\_utilization\_alert](#input\_create\_utilization\_alert) | (Optional) Whether to create a savings plan utilization budget. Defaults to true. | `bool` | `true` | no |
| <a name="input_subscriber_email_addresses"></a> [subscriber\_email\_addresses](#input\_subscriber\_email\_addresses) | (Optional) E-Mail addresses to notify. Either this or subscriber\_sns\_topic\_arns is required. | `list(string)` | `[]` | no |
| <a name="input_subscriber_sns_topic_arns"></a> [subscriber\_sns\_topic\_arns](#input\_subscriber\_sns\_topic\_arns) | (Optional) SNS topics to notify. Either this or subscriber\_email\_addresses is required. | `list(string)` | `[]` | no |
| <a name="input_threshold"></a> [threshold](#input\_threshold) | (Optional) Threshold when the notification should be sent. | `number` | `90` | no |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/savings_plans/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.64"
}
}
}
Loading

0 comments on commit 7c54812

Please sign in to comment.