Skip to content

Commit

Permalink
fix: add basic and complete example
Browse files Browse the repository at this point in the history
  • Loading branch information
themaheshyadav committed Aug 1, 2023
1 parent ceb79f9 commit 7cf2829
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,29 @@ updates:
- "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/basic" # 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/complete" # 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
14 changes: 11 additions & 3 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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//resource-alerts/'
tf-checks-basic-example:
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/'
52 changes: 52 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,58 @@ include:
# How to use this project
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" {
Expand Down
27 changes: 27 additions & 0 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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"
}
]
}
]
}
6 changes: 6 additions & 0 deletions _examples/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "id" {
value = module.uptime-alert
}
10 changes: 10 additions & 0 deletions _examples/basic/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Terraform version
terraform {
required_version = ">= 1.5.4"
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = ">= 2.29.0"
}
}
}
27 changes: 27 additions & 0 deletions _examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
6 changes: 6 additions & 0 deletions _examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "id" {
value = module.uptime-alert
}
10 changes: 10 additions & 0 deletions _examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Terraform version
terraform {
required_version = ">= 1.5.4"
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = ">= 2.29.0"
}
}
}

0 comments on commit 7cf2829

Please sign in to comment.