diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57bdcfa..7220262 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # These owners will be the default owners for everything in the repo. -* @anmolnagpal @clouddrove/approvers @clouddrove-ci +@terraform-do-modules/approvers @clouddrove-ci @anmolnagpal diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6410ec6..9b19eb4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,16 +5,15 @@ version: 2 updates: - - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" open-pull-requests-limit: 3 assignees: - - "clouddrove-ci" + - "clouddrove-ci" reviewers: - - "approvers" + - "approvers" - package-ecosystem: "terraform" # See documentation for possible values directory: "/" # Location of package manifests @@ -22,35 +21,61 @@ updates: interval: "weekly" # Add assignees assignees: - - "clouddrove-ci" + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + + - package-ecosystem: "terraform" # See documentation for possible values + directory: "/_examples/resource-alert" # Location of package manifests + schedule: + interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + + - package-ecosystem: "terraform" # See documentation for possible values + directory: "/_examples/uptime-alert" # Location of package manifests + schedule: + interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" # Add reviewer reviewers: - - "approvers" + - "approvers" # Allow up to 3 open pull requests for pip dependencies open-pull-requests-limit: 3 - package-ecosystem: "terraform" # See documentation for possible values - directory: "/_example/basic" # Location of package manifests + directory: "/_examples/basic" # Location of package manifests schedule: interval: "weekly" # Add assignees assignees: - - "clouddrove-ci" + - "clouddrove-ci" # Add reviewer reviewers: - - "approvers" + - "approvers" # Allow up to 3 open pull requests for pip dependencies open-pull-requests-limit: 3 - package-ecosystem: "terraform" # See documentation for possible values - directory: "/_example/complete" # Location of package manifests + directory: "/_examples/complete" # Location of package manifests schedule: interval: "weekly" # Add assignees assignees: - - "clouddrove-ci" + - "clouddrove-ci" # Add reviewer reviewers: - - "approvers" + - "approvers" # Allow up to 3 open pull requests for pip dependencies open-pull-requests-limit: 3 diff --git a/.github/workflows/auto_assignee.yml b/.github/workflows/auto_assignee.yml index fd2ebf1..0ef4a25 100644 --- a/.github/workflows/auto_assignee.yml +++ b/.github/workflows/auto_assignee.yml @@ -3,7 +3,6 @@ name: Auto Assign PRs on: pull_request: types: [opened, reopened] - workflow_dispatch: jobs: assign-pr: @@ -11,4 +10,4 @@ jobs: secrets: GITHUB: ${{ secrets.GITHUB }} with: - assignees: 'clouddrove-ci' \ No newline at end of file + assignees: 'clouddrove-ci' diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 8810fc4..7a74ad3 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -8,6 +8,7 @@ on: jobs: call-workflow-changelog: uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master - secrets: inherit + secrets: + GITHUB: ${{ secrets.GITHUB }} with: branch: 'master' diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 4bd38ee..d063f36 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -25,7 +25,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: 'pre-commit check errors' uses: pre-commit/action@v3.0.0 continue-on-error: true diff --git a/.github/workflows/tf-checks.yml b/.github/workflows/tf-checks.yml index 6d23309..720fe06 100644 --- a/.github/workflows/tf-checks.yml +++ b/.github/workflows/tf-checks.yml @@ -5,11 +5,19 @@ on: pull_request: workflow_dispatch: jobs: - tf-checks-complete-example: + tf-checks-resource-alerts-example: uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master with: - working_directory: './_examples/complete/' + working_directory: './_examples/resource-alerts/' + tf-checks-uptime-alerts-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master + with: + working_directory: './_examples/uptime-alerts/' tf-checks-basic-example: uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master with: working_directory: './_examples/basic/' + tf-checks-complete-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master + with: + working_directory: './_examples/complete/' diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml index 99c6300..71a6fc4 100644 --- a/.github/workflows/tflint.yml +++ b/.github/workflows/tflint.yml @@ -6,6 +6,6 @@ on: workflow_dispatch: jobs: tf-lint: - uses: clouddrove/test-tfsec/.github/workflows/tflint.yaml@master + uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master secrets: - GITHUB: ${{ secrets.GITHUB }} \ No newline at end of file + GITHUB: ${{ secrets.GITHUB }} diff --git a/.github/workflows/tfsec.yml b/.github/workflows/tfsec.yml index c203751..b9d03de 100644 --- a/.github/workflows/tfsec.yml +++ b/.github/workflows/tfsec.yml @@ -6,6 +6,7 @@ on: jobs: tfsec: uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master - secrets: inherit + secrets: + GITHUB: ${{ secrets.GITHUB }} with: working_directory: '.' diff --git a/README.yaml b/README.yaml index 42f068c..0a38e38 100644 --- a/README.yaml +++ b/README.yaml @@ -5,36 +5,147 @@ # # Name of this project -name : Terraform Module Template +name : Terraform DigitalOcean Monitoring # License of this project license: "APACHE" # Canonical GitHub repo -github_repo: clouddrove/terraform-module-template +github_repo: terraform-do-modules/terraform-digitalocean-monitoring # Badges to display badges: - name: "Latest Release" - image: "https://img.shields.io/github/release/clouddrove/terraform-module-template.svg" - url: "https://github.com/clouddrove/terraform-module-template/releases/latest" + image: "https://img.shields.io/github/release/terraform-do-modules/terraform-digitalocean-monitoring.svg" + url: "https://github.com/terraform-do-modules/terraform-digitalocean-monitoring/releases/latest" - name: "tfsec" - image: "https://github.com/clouddrove/terraform-module-template/actions/workflows/tfsec.yml/badge.svg" - url: "" + image: "https://github.com/terraform-do-modules/terraform-digitalocean-monitoring/actions/workflows/tfsec.yml/badge.svg" + url: "https://github.com/terraform-do-modules/terraform-digitalocean-monitoring/actions/workflows/tfsec.yml" - name: "Licence" image: "https://img.shields.io/badge/License-APACHE-blue.svg" url: "LICENSE.md" +prerequesties: + - name: Terraform 1.5.4 + url: https://learn.hashicorp.com/terraform/getting-started/install.html + # description of this project description: |- - Terraform module template to create new modules using this as baseline + Terraform module to create Digitalocean monitoring service resource on Digitalocean. # extra content include: - "terraform.md" # How to use this project -# How to use this project -usage: |- - Here are some examples of how you can use this module in your inventory structure: +usage : |- + Here are examples of how you can use this module in your inventory structure: + ### basic example + ```hcl + module "uptime-alert" { + source = "terraform-do-modules/monitoring/digitalocean" + version = "1.0.0" + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/"] + type = ["http"] + alert_type = ["down_global"] + period = ["2m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] + } + ``` + ### complete example + ```hcl + module "uptime-alert" { + source = "terraform-do-modules/monitoring/digitalocean" + version = "1.0.0" + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/", "https://test2.do.clouddrove.ca/"] + type = ["http", "https"] + alert_type = ["down_global"] + period = ["2m", "3m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] + } + ``` + ### resource alert + ```hcl + module "resource-alert" { + source = "terraform-do-modules/monitoring/digitalocean" + version = "1.0.0" + name = "app" + environment = "test" + resource_alerts = { + "alert1" = { + alerts = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] + window = "5m" + type = "v1/insights/droplet/cpu" + compare = "GreaterThan" + value = 95 + enabled = true + entities = [module.droplet.id[0]] + description = "Alert about CPU usage" + tags = ["test"] + }, + } + } + ``` + ### uptime alert ```hcl - ``` + module "uptime-alert" { + source = "terraform-do-modules/monitoring/digitalocean" + version = "1.0.0" + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/", "https://test2.do.clouddrove.ca/"] + type = ["http", "https"] + alert_type = ["down_global"] + period = ["2m", "3m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] + } + ``` diff --git a/_examples/basic/README.md b/_examples/basic/README.md deleted file mode 100644 index 1ff054e..0000000 --- a/_examples/basic/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## examples/basic - -An example which shows _basic_ usage of the module. diff --git a/_examples/basic/main.tf b/_examples/basic/main.tf index a07c2e6..c3006ea 100644 --- a/_examples/basic/main.tf +++ b/_examples/basic/main.tf @@ -1,4 +1,27 @@ -# ------------------------------------------------------------------------------ -# Resources -# ------------------------------------------------------------------------------ -locals {} +provider "digitalocean" {} + +##------------------------------------------------ +## alert module call. +##------------------------------------------------ +module "uptime-alert" { + source = "./../.." + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/"] + type = ["http"] + alert_type = ["down_global"] + period = ["2m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] +} diff --git a/_examples/basic/outputs.tf b/_examples/basic/outputs.tf index 7ebf362..fda9f77 100644 --- a/_examples/basic/outputs.tf +++ b/_examples/basic/outputs.tf @@ -1,3 +1,6 @@ # ------------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------------ +output "id" { + value = module.uptime-alert +} diff --git a/_examples/basic/variables.tf b/_examples/basic/variables.tf deleted file mode 100644 index dc91c44..0000000 --- a/_examples/basic/variables.tf +++ /dev/null @@ -1,3 +0,0 @@ -# ------------------------------------------------------------------------------ -# Variables -# ------------------------------------------------------------------------------ diff --git a/_examples/basic/versions.tf b/_examples/basic/versions.tf new file mode 100644 index 0000000..acbd0ae --- /dev/null +++ b/_examples/basic/versions.tf @@ -0,0 +1,10 @@ +# Terraform version +terraform { + required_version = ">= 1.5.4" + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = ">= 2.29.0" + } + } +} diff --git a/_examples/complete/README.md b/_examples/complete/README.md deleted file mode 100644 index 743bb00..0000000 --- a/_examples/complete/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## examples/complete - -An example which shows _complete_ usage of the module. diff --git a/_examples/complete/main.tf b/_examples/complete/main.tf index a07c2e6..43a09c2 100644 --- a/_examples/complete/main.tf +++ b/_examples/complete/main.tf @@ -1,4 +1,27 @@ -# ------------------------------------------------------------------------------ -# Resources -# ------------------------------------------------------------------------------ -locals {} +provider "digitalocean" {} + +##------------------------------------------------ +## alert module call. +##------------------------------------------------ +module "uptime-alert" { + source = "./../.." + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/", "https://test2.do.clouddrove.ca/"] + type = ["http", "https"] + alert_type = ["down_global"] + period = ["2m", "3m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] +} diff --git a/_examples/complete/outputs.tf b/_examples/complete/outputs.tf index 7ebf362..fda9f77 100644 --- a/_examples/complete/outputs.tf +++ b/_examples/complete/outputs.tf @@ -1,3 +1,6 @@ # ------------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------------ +output "id" { + value = module.uptime-alert +} diff --git a/_examples/complete/variables.tf b/_examples/complete/variables.tf deleted file mode 100644 index dc91c44..0000000 --- a/_examples/complete/variables.tf +++ /dev/null @@ -1,3 +0,0 @@ -# ------------------------------------------------------------------------------ -# Variables -# ------------------------------------------------------------------------------ diff --git a/_examples/complete/versions.tf b/_examples/complete/versions.tf new file mode 100644 index 0000000..acbd0ae --- /dev/null +++ b/_examples/complete/versions.tf @@ -0,0 +1,10 @@ +# Terraform version +terraform { + required_version = ">= 1.5.4" + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = ">= 2.29.0" + } + } +} diff --git a/_examples/resource-alerts/main.tf b/_examples/resource-alerts/main.tf new file mode 100644 index 0000000..646f5d6 --- /dev/null +++ b/_examples/resource-alerts/main.tf @@ -0,0 +1,76 @@ +provider "digitalocean" {} + +locals { + name = "app" + environment = "test" + region = "blr1" +} + +##------------------------------------------------ +## VPC module call +##------------------------------------------------ +module "vpc" { + source = "terraform-do-modules/vpc/digitalocean" + version = "1.0.0" + name = local.name + environment = local.environment + region = local.region + ip_range = "10.10.0.0/16" +} + +##------------------------------------------------ +## Droplet module call +##------------------------------------------------ +module "droplet" { + source = "terraform-do-modules/droplet/digitalocean" + version = "1.0.0" + name = local.name + environment = local.environment + region = local.region + vpc_uuid = module.vpc.id + + ssh_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg" + ####firewall + inbound_rules = [ + { + allowed_ip = ["10.10.0.0/16"] + allowed_ports = "22" + }, + { + allowed_ip = ["0.0.0.0/0"] + allowed_ports = "80" + } + ] +} + +##------------------------------------------------ +## resource alert module call. +##------------------------------------------------ +module "resource-alert" { + source = "./../.." + name = local.name + environment = local.environment + resource_alerts = { + "alert1" = { + alerts = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] + window = "5m" + type = "v1/insights/droplet/cpu" + compare = "GreaterThan" + value = 95 + enabled = true + entities = [module.droplet.id[0]] + description = "Alert about CPU usage" + tags = ["test"] + }, + } +} diff --git a/_examples/basic/variables.auto.tfvars b/_examples/resource-alerts/outputs.tf similarity index 71% rename from _examples/basic/variables.auto.tfvars rename to _examples/resource-alerts/outputs.tf index dc91c44..ca98936 100644 --- a/_examples/basic/variables.auto.tfvars +++ b/_examples/resource-alerts/outputs.tf @@ -1,3 +1,6 @@ # ------------------------------------------------------------------------------ -# Variables +# Outputs # ------------------------------------------------------------------------------ +output "uuid" { + value = module.resource-alert.uuid +} diff --git a/_examples/resource-alerts/versions.tf b/_examples/resource-alerts/versions.tf new file mode 100644 index 0000000..acbd0ae --- /dev/null +++ b/_examples/resource-alerts/versions.tf @@ -0,0 +1,10 @@ +# Terraform version +terraform { + required_version = ">= 1.5.4" + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = ">= 2.29.0" + } + } +} diff --git a/_examples/uptime-alerts/main.tf b/_examples/uptime-alerts/main.tf new file mode 100644 index 0000000..43a09c2 --- /dev/null +++ b/_examples/uptime-alerts/main.tf @@ -0,0 +1,27 @@ +provider "digitalocean" {} + +##------------------------------------------------ +## alert module call. +##------------------------------------------------ +module "uptime-alert" { + source = "./../.." + name = "app" + environment = "test" + target_url = ["http://test.do.clouddrove.ca/", "https://test2.do.clouddrove.ca/"] + type = ["http", "https"] + alert_type = ["down_global"] + period = ["2m", "3m"] + comparison = ["less_than"] + #### + notifications = [ + { + email = ["example@gmail.com"] + slack = [ + { + channel = "testing" + url = "https://hooks.slack.com/services/TEXXXXXXXXxxxxYTGH8DNkjgggyKipj" + } + ] + } + ] +} diff --git a/_examples/complete/variables.auto.tfvars b/_examples/uptime-alerts/outputs.tf similarity index 74% rename from _examples/complete/variables.auto.tfvars rename to _examples/uptime-alerts/outputs.tf index dc91c44..fda9f77 100644 --- a/_examples/complete/variables.auto.tfvars +++ b/_examples/uptime-alerts/outputs.tf @@ -1,3 +1,6 @@ # ------------------------------------------------------------------------------ -# Variables +# Outputs # ------------------------------------------------------------------------------ +output "id" { + value = module.uptime-alert +} diff --git a/_examples/uptime-alerts/versions.tf b/_examples/uptime-alerts/versions.tf new file mode 100644 index 0000000..acbd0ae --- /dev/null +++ b/_examples/uptime-alerts/versions.tf @@ -0,0 +1,10 @@ +# Terraform version +terraform { + required_version = ">= 1.5.4" + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = ">= 2.29.0" + } + } +} diff --git a/main.tf b/main.tf index 6b53c8f..78c257b 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,78 @@ -# ------------------------------------------------------------------------------ -# Resources -# ------------------------------------------------------------------------------ -locals { +##Description : This Script is used to create VPC. +#Module : LABEL +#Description : Terraform label module variables. +module "labels" { + source = "terraform-do-modules/labels/digitalocean" + version = "0.0.1" + name = var.name + environment = var.environment + managedby = var.managedby label_order = var.label_order } + +################################################################################################# +##Description : Uptime Checks provide the ability to monitor your endpoints from around the world +################################################################################################# +resource "digitalocean_uptime_check" "main" { + count = var.enable ? length(var.target_url) : 0 + name = format("%s-uptime-check-%s", module.labels.id, count.index) + target = element(var.target_url, count.index) + type = element(var.type, count.index) + regions = var.regions + enabled = var.enabled +} + +################################################################################################################################################################################ +##Description : Uptime Alerts provide the ability to add alerts to your DigitalOcean Uptime Checks when your endpoints are slow, unavailable, or SSL certificates are expiring. +################################################################################################################################################################################ +resource "digitalocean_uptime_alert" "main" { + count = var.enable ? length(var.target_url) : 0 + name = format("%s-alert", module.labels.id) + check_id = element(concat(digitalocean_uptime_check.main[*].id, [""]), count.index) + type = element(var.alert_type, count.index) + threshold = element(var.threshold, count.index) + comparison = element(var.comparison, count.index) + period = element(var.period, count.index) + + dynamic "notifications" { + for_each = try(jsondecode(var.notifications), var.notifications) ##var.notifications == [] ? 0 : 1 + content { + email = lookup(notifications.value, "email", null) + dynamic "slack" { + for_each = lookup(notifications.value, "slack", []) + content { + channel = lookup(slack.value, "channel", null) + url = lookup(slack.value, "url", null) + } + } + } + } +} + +########################################################### +##Description :Monitor alerts can be configured to alert +########################################################### +resource "digitalocean_monitor_alert" "cpu_alert" { + for_each = var.resource_alerts + dynamic "alerts" { + for_each = each.value.alerts + content { + email = lookup(alerts.value, "email", null) + dynamic "slack" { + for_each = lookup(alerts.value, "slack", null) + content { + channel = lookup(slack.value, "channel", null) + url = lookup(slack.value, "url", null) + } + } + } + } + description = lookup(each.value, "description", null) + compare = lookup(each.value, "compare", null) + type = lookup(each.value, "type", null) + enabled = lookup(each.value, "enabled", true) + entities = lookup(each.value, "entities", null) + value = lookup(each.value, "value", 95) + window = lookup(each.value, "window", "5m") + tags = lookup(each.value, "tags", null) +} diff --git a/outputs.tf b/outputs.tf index ff3d337..9977397 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,16 @@ # ------------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------------ -output "label_order" { - value = local.label_order - description = "Label order." +output "uptime_check_id" { + value = element(concat(digitalocean_uptime_check.main[*].id[*], [""]), 0) ##digitalocean_uptime_check.main[*].id[*] + description = " The id of the check." +} +output "uptime_alert_id" { + value = join("", digitalocean_uptime_alert.main[*].id) + description = "The id of the alert." +} + +output "uuid" { + value = digitalocean_monitor_alert.cpu_alert + description = "The uuid of the alert." } diff --git a/variables.tf b/variables.tf index 7018939..7a641f0 100644 --- a/variables.tf +++ b/variables.tf @@ -1,8 +1,89 @@ -# ------------------------------------------------------------------------------ -# Variables -# ------------------------------------------------------------------------------ +#Module : LABEL +#Description : Terraform label module variables. +variable "name" { + type = string + default = "" + description = "Name (e.g. `app` or `cluster`)." +} + +variable "environment" { + type = string + default = "" + description = "Environment (e.g. `prod`, `dev`, `staging`)." +} + variable "label_order" { - type = list(string) + type = list(any) default = ["name", "environment"] - description = "Label order, e.g. `name`,`environment`." + description = "Label order, e.g. `name`." +} + +variable "managedby" { + type = string + default = "terraform-do-modules" + description = "ManagedBy, eg 'terraform-do-modules'" +} + +variable "target_url" { + type = list(any) + default = [] + description = "The endpoint to perform healthchecks on." +} + +variable "type" { + type = list(string) + default = [] + description = "The type of health check to perform: 'ping' 'http' 'https'." +} +variable "regions" { + type = list(string) + default = ["us_east", "us_west", "eu_west", "se_asia"] + description = "An array containing the selected regions to perform healthchecks from: 'us_east', 'us_west', 'eu_west', 'se_asia''" +} + +variable "enable" { + type = bool + default = true + description = "A boolean value indicating whether the check is enabled/disabled." +} + +variable "enabled" { + type = bool + default = true + description = "A boolean value indicating whether the check is enabled/disabled." +} + +variable "alert_type" { + type = list(any) + default = ["down_global"] + description = "The type of health check to perform. Must be one of latency, down, down_global or ssl_expiry." +} + +variable "threshold" { + type = list(any) + default = [1] + description = "The threshold at which the alert will enter a trigger state. The specific threshold is dependent on the alert type." +} + +variable "comparison" { + type = list(any) + default = ["less_than"] + description = "The comparison operator used against the alert's threshold. Must be one of greater_than or less_than." +} + +variable "period" { + type = list(string) + default = ["2m"] + description = "Period of time the threshold must be exceeded to trigger the alert. Must be one of 2m, 3m, 5m, 10m, 15m, 30m or 1h." +} + +variable "notifications" { + type = list(any) + default = [] + description = "The notification settings for a trigger alert." +} + +variable "resource_alerts" { + type = map(any) + default = {} } diff --git a/versions.tf b/versions.tf index 3104655..acbd0ae 100644 --- a/versions.tf +++ b/versions.tf @@ -1,12 +1,10 @@ -# ------------------------------------------------------------------------------ -# Versions -# ------------------------------------------------------------------------------ +# Terraform version terraform { - required_version = ">= 1.4.6" + required_version = ">= 1.5.4" required_providers { - aws = { - source = "hashicorp/aws" - version = ">= 5.1.0" + digitalocean = { + source = "digitalocean/digitalocean" + version = ">= 2.29.0" } } }