Skip to content

Commit

Permalink
Maintenance:
Browse files Browse the repository at this point in the history
- Updated README.md
- Updated deprecated policy calls
- Bumped minimal Terraform version
- Added types to variables.tf
  • Loading branch information
AutomationD committed May 21, 2024
1 parent e88aa4c commit 983545f
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 5 deletions.
69 changes: 67 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ failover routing policy to S3 public website bucket with "Maintenance page"
```
module "route53-health-check" {
source = "hazelops/route53-healthcheck/aws""
version = "~> 1.0"
env = "production"
name = "my-monitoring"
port = "80"
Expand All @@ -32,3 +31,69 @@ module "route53-health-check" {
}
```
Note: This module just creates a secondary Route53 record for failover routing policy. Creating a primary record is out of scope of this module.

<!-- BEGIN_TF_DOCS -->
## Requirements

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

## Providers

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

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_cloudwatch_metric_alarm.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
| [aws_route53_health_check.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_health_check) | resource |
| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_s3_bucket.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_acl.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_website_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_website_configuration) | resource |
| [aws_sns_topic.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
| [aws_sns_topic_subscription.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cw_alarm_comparison_operator"></a> [cw\_alarm\_comparison\_operator](#input\_cw\_alarm\_comparison\_operator) | Comparison Operator of Cloudwatch metric alarm | `string` | `"LessThanThreshold"` | no |
| <a name="input_cw_alarm_evaluation_periods"></a> [cw\_alarm\_evaluation\_periods](#input\_cw\_alarm\_evaluation\_periods) | Evaluation periods of Cloudwatch metric alarm | `string` | `"1"` | no |
| <a name="input_cw_alarm_metric_name"></a> [cw\_alarm\_metric\_name](#input\_cw\_alarm\_metric\_name) | Metric name of Cloudwatch metric alarm | `string` | `"HealthCheckStatus"` | no |
| <a name="input_cw_alarm_namespace"></a> [cw\_alarm\_namespace](#input\_cw\_alarm\_namespace) | Namespace of Cloudwatch metric alarm | `string` | `"AWS/Route53"` | no |
| <a name="input_cw_alarm_period"></a> [cw\_alarm\_period](#input\_cw\_alarm\_period) | Period of Cloudwatch metric alarm | `string` | `"60"` | no |
| <a name="input_cw_alarm_statistic"></a> [cw\_alarm\_statistic](#input\_cw\_alarm\_statistic) | Statistic of Cloudwatch metric alarm | `string` | `"Minimum"` | no |
| <a name="input_cw_alarm_threshold"></a> [cw\_alarm\_threshold](#input\_cw\_alarm\_threshold) | Threshold of Cloudwatch metric alarm | `string` | `"1"` | no |
| <a name="input_cw_alarm_unit"></a> [cw\_alarm\_unit](#input\_cw\_alarm\_unit) | Unit of Cloudwatch metric alarm | `string` | `"None"` | no |
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | n/a | `any` | n/a | yes |
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Gives ability to enable or disable a module | `bool` | `true` | no |
| <a name="input_endpoint_auto_confirms"></a> [endpoint\_auto\_confirms](#input\_endpoint\_auto\_confirms) | Endpoint endpoint for SNS topic subscription, PagerDuty (https://events.pagerduty.com/integration/<Integration Key>/enqueue) | `bool` | `true` | no |
| <a name="input_env"></a> [env](#input\_env) | n/a | `any` | n/a | yes |
| <a name="input_failure_threshold"></a> [failure\_threshold](#input\_failure\_threshold) | The number of consecutive health checks that an endpoint must pass or fail. | `string` | `"3"` | no |
| <a name="input_fqdn"></a> [fqdn](#input\_fqdn) | The FQDN of the endpoint to be monitored | `string` | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | The name of the monitoring and name of the subscription service endpoint | `string` | n/a | yes |
| <a name="input_port"></a> [port](#input\_port) | The port of the endpoint to be monitored | `string` | `"443"` | no |
| <a name="input_r53_failover_enabled"></a> [r53\_failover\_enabled](#input\_r53\_failover\_enabled) | Enabling creating secondary Failover R53 Record | `bool` | `false` | no |
| <a name="input_request_interval"></a> [request\_interval](#input\_request\_interval) | The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request. | `string` | `"30"` | no |
| <a name="input_resource_path"></a> [resource\_path](#input\_resource\_path) | The path that you want Amazon Route 53 to request when performing health checks. | `string` | `"/"` | no |
| <a name="input_subscription_endpoint"></a> [subscription\_endpoint](#input\_subscription\_endpoint) | Endpoint endpoint for SNS topic subscription, PagerDuty, Slack etc. | `string` | n/a | yes |
| <a name="input_subscription_endpoint_protocol"></a> [subscription\_endpoint\_protocol](#input\_subscription\_endpoint\_protocol) | Endpoint protocol for SNS topic subscription | `string` | `"https"` | no |
| <a name="input_type"></a> [type](#input\_type) | The protocol to use when performing health checks. Valid values are HTTP, HTTPS, HTTP\_STR\_MATCH, HTTPS\_STR\_MATCH, TCP, CALCULATED and CLOUDWATCH\_METRIC | `string` | `"HTTPS"` | no |

## Outputs

No outputs.
<!-- END_TF_DOCS -->
7 changes: 5 additions & 2 deletions s3_website.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ resource "aws_s3_bucket" "this" {
Terraform = "true"
Name = "${var.env}-${var.name}"
}
}

resource "aws_s3_bucket_policy" "this" {
bucket = aws_s3_bucket.this[0].id
policy = <<EOF
{
"Version": "2008-10-17",
Expand All @@ -24,9 +27,9 @@ resource "aws_s3_bucket" "this" {
]
}
EOF

}


resource "aws_s3_bucket_acl" "this" {
bucket = aws_s3_bucket.this[0].id
acl = "public-read"
Expand All @@ -51,7 +54,7 @@ resource "aws_route53_record" "this" {
type = "A"

alias {
name = aws_s3_bucket.this[0].website_domain
name = aws_s3_bucket_website_configuration.this[0].website_domain
zone_id = aws_s3_bucket.this[0].hosted_zone_id
evaluate_target_health = false
}
Expand Down
17 changes: 17 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ variable "env" {}
variable "domain_name" {}

variable "name" {
type = string
description = "The name of the monitoring and name of the subscription service endpoint"
}

variable "subscription_endpoint" {
type = string
description = "Endpoint endpoint for SNS topic subscription, PagerDuty, Slack etc."
}

Expand All @@ -16,75 +18,90 @@ variable "endpoint_auto_confirms" {
}

variable "fqdn" {
type = string
description = "The FQDN of the endpoint to be monitored"
}

variable "subscription_endpoint_protocol" {
type = string
default = "https"
description = "Endpoint protocol for SNS topic subscription"
}

variable "port" {
type = string
default = "443"
description = "The port of the endpoint to be monitored"
}

variable "type" {
type = string
default = "HTTPS"
description = "The protocol to use when performing health checks. Valid values are HTTP, HTTPS, HTTP_STR_MATCH, HTTPS_STR_MATCH, TCP, CALCULATED and CLOUDWATCH_METRIC"
}

variable "resource_path" {
type = string
default = "/"
description = "The path that you want Amazon Route 53 to request when performing health checks."
}

variable "failure_threshold" {
type = string
default = "3"
description = "The number of consecutive health checks that an endpoint must pass or fail."
}

variable "request_interval" {
type = string
default = "30"
description = "The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request."
}

variable "cw_alarm_namespace" {
type = string
default = "AWS/Route53"
description = "Namespace of Cloudwatch metric alarm"
}

variable "cw_alarm_comparison_operator" {
type = string
default = "LessThanThreshold"
description = "Comparison Operator of Cloudwatch metric alarm"
}

variable "cw_alarm_metric_name" {
type = string
default = "HealthCheckStatus"
description = "Metric name of Cloudwatch metric alarm"
}

variable "cw_alarm_evaluation_periods" {
type = string
default = "1"
description = "Evaluation periods of Cloudwatch metric alarm"
}

variable "cw_alarm_period" {
type = string
default = "60"
description = "Period of Cloudwatch metric alarm"
}

variable "cw_alarm_statistic" {
type = string
default = "Minimum"
description = "Statistic of Cloudwatch metric alarm"
}

variable "cw_alarm_threshold" {
type = string
default = "1"
description = "Threshold of Cloudwatch metric alarm"
}

variable "cw_alarm_unit" {
type = string
default = "None"
description = "Unit of Cloudwatch metric alarm"
}
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ terraform {
version = ">= 3.0"
}
}
required_version = ">= 0.12"
required_version = ">= 1.1"
}

0 comments on commit 983545f

Please sign in to comment.