This Terraform provider allows you to manage your UptimeRobot resources programmatically.
This is the official UptimeRobot Terraform provider.
- Terraform >= 1.5 or OpenTofu >= 1.7
- An UptimeRobot account.
- An UptimeRobot API Key. You can generate your Main API Key from your UptimeRobot dashboard under "My Settings" -> "API Settings" -> "Main API Key".
To use this provider, add the following to your Terraform configuration, then run terraform init.
terraform {
required_providers {
uptimerobot = {
source = "uptimerobot/uptimerobot"
version = "~> 1.3.0"
}
}
}
provider "uptimerobot" {
# Configuration options
}The provider requires an API key to interact with the UptimeRobot API.
provider "uptimerobot" {
api_key = "YOUR_UPTIMEROBOT_API_KEY"
# api_url = "https://api.uptimerobot.com/v3" # Optional: Default is UptimeRobot API v3 URL
}api_key(String, Required): Your UptimeRobot Main API Key.api_url(String, Optional): The base URL for the UptimeRobot API. Defaults tohttps://api.uptimerobot.com/v3. Useful if UptimeRobot offers different API endpoints or for testing purposes.
Here's an example of how to create an UptimeRobot monitor, a maintenance window, an integration, and a public status page:
terraform {
required_providers {
uptimerobot = {
source = "uptimerobot/uptimerobot"
version = "~> 1.3.0"
}
}
}
provider "uptimerobot" {
api_key = "YOUR_UPTIMEROBOT_API_KEY"
}
resource "uptimerobot_monitor" "website" {
name = "My Website"
type = "HTTP"
url = "https://example.com"
interval = 300
}
resource "uptimerobot_maintenance_window" "weekly" {
name = "Weekly Maintenance"
type = "weekly"
duration = 60
interval = "weekly"
time = "23:00"
}
resource "uptimerobot_integration" "slack" {
name = "Team Slack"
type = "slack"
value = "https://hooks.slack.com/services/XXXXX/YYYYY/ZZZZZ"
}
resource "uptimerobot_psp" "main_status" {
name = "Example.com Status"
monitor_ids = [uptimerobot_monitor.website.id]
}Detailed documentation for the resources supported by this provider can be found in the docs/resources/ directory or by clicking the links below:
This provider does not currently expose data sources. When data sources are added, their documentation will live under docs/data-sources/.
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.24 or higher is recommended).
-
Clone the repository.
-
Enter the repository directory.
-
Build the provider using the Go
installcommand:go install
This will build the provider and put the provider binary in the
$GOPATH/bindirectory (or$GOBINif set).
To use your locally built provider for testing with a Terraform configuration, you can specify the development override in your Terraform CLI configuration file. See Provider Development Overrides.
Example ~/.terraformrc or terraform.rc:
provider_installation {
dev_overrides {
"uptimerobot/uptimerobot" = "/path/to/your/gopath/bin" # or wherever 'go install' places the binary
# For example: "uptimerobot/uptimerobot" = "$HOME/go/bin"
}
# For TF 0.13+ installations, you can also use a direct path to the binary
# fs_mirror {
# "https://registry.terraform.io/providers/uptimerobot/uptimerobot" = "/path/to/your/project/terraform-provider-uptimerobot"
# }
}If you have tfplugindocs installed, you can generate or update documentation by running:
go generateAcceptance tests create real resources against the UptimeRobot API and may incur costs or affect your UptimeRobot account.
Ensure you have the UPTIMEROBOT_API_KEY environment variable set before running tests.
To run the full suite of Acceptance tests:
make testaccNote: Acceptance tests create real resources
This provider uses Go modules.
To add a new dependency github.com/author/dependency:
go get github.com/author/dependency
go mod tidyThen commit the changes to go.mod and go.sum.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on proposing changes, running tests, and opening pull requests.
This provider is distributed under the Mozilla Public License Version 2.0. See the LICENSE file for more information.