|
| 1 | +# Terraform UptimeRobot Modules |
| 2 | + |
| 3 | +Opinionated Terraform wrapper modules for managing [UptimeRobot](https://uptimerobot.com/) resources efficiently. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +> [!NOTE] |
| 8 | +> This is an example setup. Adjust paths, module names, and versions according to your project needs. |
| 9 | +
|
| 10 | +### Folder Structure |
| 11 | + |
| 12 | +Recommended folder structure: |
| 13 | + |
| 14 | +```bash |
| 15 | +terraform |
| 16 | +├── monitors_toggle.tf |
| 17 | +└── toggle |
| 18 | + ├── modules |
| 19 | + │ ├── cron_monitor |
| 20 | + │ └── http_monitor |
| 21 | + └── README.md |
| 22 | +``` |
| 23 | + |
| 24 | +### Add Submodules |
| 25 | + |
| 26 | +```bash |
| 27 | +mkdir terraform |
| 28 | + |
| 29 | +git submodule add \ |
| 30 | + git@github.com:toggle-corp/fugit.git \ |
| 31 | + fugit |
| 32 | + |
| 33 | +git submodule add \ |
| 34 | + git@github.com:toggle-corp/terraform-uptimerobot-modules.git \ |
| 35 | + terraform/toggle |
| 36 | +``` |
| 37 | + |
| 38 | +### Configure Submodule Branches |
| 39 | + |
| 40 | +Update your `.gitmodules` file to use specific tagged branches: |
| 41 | + |
| 42 | +```gitconfig |
| 43 | +# Sync this with ./fugit/scripts/sub-module-sync.sh |
| 44 | +[submodule "terraform/toggle"] |
| 45 | + path = terraform/toggle |
| 46 | + url = git@github.com:toggle-corp/terraform-uptimerobot-modules.git |
| 47 | + branch = v0.1.0 |
| 48 | + |
| 49 | +[submodule "fugit"] |
| 50 | + path = fugit |
| 51 | + url = git@github.com:toggle-corp/fugit.git |
| 52 | + branch = v0.1.3 |
| 53 | +``` |
| 54 | + |
| 55 | +> [!IMPORTANT] |
| 56 | +> Replace `v0.1.0` and `v0.1.3` with the latest release tags from the respective repositories: |
| 57 | +> |
| 58 | +> - https://github.com/toggle-corp/terraform-uptimerobot-modules/releases |
| 59 | +> - https://github.com/toggle-corp/fugit/releases |
| 60 | + |
| 61 | +### Sync Submodules |
| 62 | + |
| 63 | +```bash |
| 64 | +./fugit/scripts/sub-module-sync.sh |
| 65 | +``` |
| 66 | + |
| 67 | +Add and commit your submodule setup. |
| 68 | + |
| 69 | +## Usage |
| 70 | + |
| 71 | +### Example: HTTP Monitor |
| 72 | + |
| 73 | +Create a monitor in `monitors_toggle.tf`: |
| 74 | + |
| 75 | +```hcl |
| 76 | +module "monitor_toggle_website_prod" { |
| 77 | + source = "./toggle/modules/http_monitor" |
| 78 | + |
| 79 | + name = "Togglecorp" |
| 80 | + url = "https://togglecorp.com" |
| 81 | + tags = ["prod"] |
| 82 | + |
| 83 | + assigned_alert_contacts = [ |
| 84 | + local.toggle_email_id, |
| 85 | + local.thenav56_iphone_id, |
| 86 | + uptimerobot_integration.toggle_uptime_alerts.id, |
| 87 | + ] |
| 88 | +} |
| 89 | +``` |
0 commit comments