diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6289ac6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +# v0.1.0 +- initial release diff --git a/README.md b/README.md index dffacbb..1bd548f 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ resource "uptimerobot_monitor" "main" { } resource "uptimerobot_status_page" "main" { - friendly_name = "My Status Page" - custom_domain = "status.example.com" - password = "WeAreAwsome" - sort_monitors = "down-up-paused" - monitors = ["${resource.uptimerobot_monitor.main.id}"] - hide_logo = false # pro only + friendly_name = "My Status Page" + custom_domain = "status.example.com" + password = "WeAreAwsome" + sort_monitors = "down-up-paused" + monitors = ["${resource.uptimerobot_monitor.main.id}"] + hide_url_links = false # pro only } resource "aws_route53_record" { diff --git a/uptimerobot/resource_uptimerobot_status_page.go b/uptimerobot/resource_uptimerobot_status_page.go index 1d43011..016f0ff 100644 --- a/uptimerobot/resource_uptimerobot_status_page.go +++ b/uptimerobot/resource_uptimerobot_status_page.go @@ -55,11 +55,10 @@ func resourceStatusPage() *schema.Resource { Default: "a-z", }, "status": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - // ValidateFunc: validation.StringInSlice(mapKeys(statusPageStatus), false), - // Optional: true, - // Default: "active", + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(mapKeys(statusPageStatus), false), + Default: "active", }, "monitors": &schema.Schema{ Type: schema.TypeList, @@ -107,7 +106,7 @@ func resourceStatusPageCreate(d *schema.ResourceData, m interface{}) error { } // log.Printf("[DEBUG] Sort: %s %d", d.Get("sort").(string), statusPageSort[d.Get("sort").(string)]) data.Add("sort", fmt.Sprintf("%d", statusPageSort[d.Get("sort").(string)])) - // data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)])) + data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)])) body, err := uptimerobotAPICall( m.(UptimeRobotConfig).apiKey, @@ -119,7 +118,6 @@ func resourceStatusPageCreate(d *schema.ResourceData, m interface{}) error { } psp := body["psp"].(map[string]interface{}) d.SetId(fmt.Sprintf("%d", int(psp["id"].(float64)))) - d.Set("status", "active") d.Set("standard_url", psp["standard_url"].(string)) if psp["custom_url"] != nil { d.Set("custom_url", psp["custom_url"].(string)) @@ -188,7 +186,7 @@ func resourceStatusPageUpdate(d *schema.ResourceData, m interface{}) error { data.Add("monitors", strings.Join(strMonitors, "-")) } data.Add("sort", fmt.Sprintf("%d", statusPageSort[d.Get("sort").(string)])) - // data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)])) + data.Add("status", fmt.Sprintf("%d", statusPageStatus[d.Get("status").(string)])) _, err := uptimerobotAPICall( m.(UptimeRobotConfig).apiKey, diff --git a/website/docs/d/account.html.markdown b/website/docs/d/account.html.markdown new file mode 100644 index 0000000..591a817 --- /dev/null +++ b/website/docs/d/account.html.markdown @@ -0,0 +1,26 @@ +--- +layout: "uptimerobot" +page_title: "UptimeRobot: uptimerobot_account" +sidebar_current: "docs-uptimerobot-datasource-account" +description: |- + Get information about your account +--- + +# Data Source: uptimerobot_account + +Use this data source to get information about the current UptimeRobot account. + +## Example Usage + +```hcl +data "uptimerobot_account" "main" {} +``` + +## Attributes Reference + + * `email` - the account e-mail + * `monitor_limit` - the max number of monitors that can be created for the account + * `monitor_interval` - the min monitoring interval (in seconds) supported by the account + * `up_monitors` - the number of "up" monitors + * `down_monitors` - the number of "down" monitors + * `pause_monitors` - the number of "paused" monitors diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown new file mode 100644 index 0000000..5d04967 --- /dev/null +++ b/website/docs/index.html.markdown @@ -0,0 +1,36 @@ +--- +layout: "uptimerobot" +page_title: "Provider: UptimeRobot" +sidebar_current: "docs-uptimerobot-index" +description: |- + The UptimeRobot provider is used to interact with the resources supported by UptimeRobot. The provider needs to be configured with the proper credentials before it can be used. +--- + +# UptimeRobot Provider +The UptimeRobot provider is used to interact with the resources supported by UptimeRobot. The provider needs to be configured with the proper credentials before it can be used. +Use the navigation to the left to read about the available resources. + +## Example Usage + +```hcl +# Configure the UptimeRobot Provider +provider "uptimerobot" { + api_key = "${var.uptimerobot_api_key}" +} + +# Create a monitor +resource "uptimerobot_monitor" "web" { + friendly_name = "My Monitor" + type = "http" + url = "http://example.com" +} +``` + +## Authentication +The UptimeRobot provider needs an account-specific (main) api key to work. You can find that key for your account in the [My Settings](https://uptimerobot.com/dashboard#mySettings) page on UptimeRobot's website. + +## Argument Reference + +The following arguments are supported in the `provider` block: + +* `api_key` - (Required) UptimeRobot's account-specific api key. diff --git a/website/docs/r/alert_contact.html.markdown b/website/docs/r/alert_contact.html.markdown new file mode 100644 index 0000000..2748436 --- /dev/null +++ b/website/docs/r/alert_contact.html.markdown @@ -0,0 +1,44 @@ +--- +- layout: `uptimerobot` +- page_title: `UptimeRobot: uptimerobot_alert_contact` +- sidebar_current: `docs-uptimerobot-resource-alert-contact` +description: |- + Set up an alert contact +--- + +# Resource: uptimerobot_alert_contact + +Use this resource to create an alert contact + +## Example Usage + +```hcl +resource `uptimerobot_alert_contact` `slack` { + friendly_name = `Slack Alert` + type = `slack` + webhook_url = `https://hooks.slack.com/services/XXXXXXX` +} +``` + +## Arguments Reference + +* `friendly_name` - friendly name of the alert contact (for making it easier to distinguish from others). +* `type` - the type of the alert contact notified (Zapier, HipChat and Slack are not supported in the api yet) + + Possible values are the following: + - `sms` + - `email` + - `twitter-dm` + - `boxcar` + - `webhook` + - `pushbullet` + - `zapier` + - `pushover` + - `hipchat` + - `slack` +* `value` - alert contact's address/phone/url + +## Attributes Reference + +* `id` - the ID of the alert contact. +* `status` - the status of the alert contact (`not activated`, `paused` or `active`) diff --git a/website/docs/r/monitor.html.markdown b/website/docs/r/monitor.html.markdown new file mode 100644 index 0000000..6261a15 --- /dev/null +++ b/website/docs/r/monitor.html.markdown @@ -0,0 +1,52 @@ +--- +layout: "uptimerobot" +page_title: "UptimeRobot: uptimerobot_monitor" +sidebar_current: "docs-uptimerobot-resource-monitor" +description: |- + Set up a monitor +--- + +# Resource: uptimerobot_monitor + +Use this resource to create a monitor + +## Example Usage + +```hcl +resource "uptimerobot_monitor" "my_website" { + friendly_name = "My Monitor" + type = "http" + url = "http://example.com" +} +``` + +## Arguments Reference + +* `friendly_name` - friendly name of the monitor (for making it easier to distinguish from others). +* `url` - the URL/IP of the monitor. +* `type` - the type of the monitor. Can be one of the following: + - *`http`* + - *`keyword`* - will also enable the following options: + - `keyword_type` - if the monitor will be flagged as down when the keyword exists or not exists. Can be one of the following: + - `exists` + - `not exists` + - `keyword_value` - the value of the keyword. + - *`ping`* + - *`port`* - will also enable the following options: + - `sub_type` - which pre-defined port/service is monitored or if a custom port is monitored. Can be one of the following: + - `http` + - `https` + - `ftp` + - `smtp` + - `pop3` + - `imap` + - `custom` + - `port` - the port monitored (only if subtype is `custom`) +* `http_username` - used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring. +* `http_password` - used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring. +* `interval` - the interval for the monitoring check (300 seconds by default). + +## Attributes Reference + +* `id` - the ID of the monitor (can be used for monitor-specific requests) +* `status` - the status of the monitor (`paused`, `not checked yet`, `up`, `seems down`, or `down`) diff --git a/website/docs/r/status_page.html.markdown b/website/docs/r/status_page.html.markdown new file mode 100644 index 0000000..44e08a6 --- /dev/null +++ b/website/docs/r/status_page.html.markdown @@ -0,0 +1,45 @@ +--- +layout: "uptimerobot" +page_title: "UptimeRobot: uptimerobot_status_page" +sidebar_current: "docs-uptimerobot-resource-status-page" +description: |- + Set up a status page +--- + +# Resource: uptimerobot_status_page + +Use this resource to create a status page + +## Example Usage + +```hcl +resource "uptimerobot_status_page" "my_status_page" { + friendly_name = "My Status Page" + custom_domain = "status.example.com" + password = "WeAreAwsome" + sort_monitors = "down-up-paused" + monitors = ["${resource.uptimerobot_monitor.main.id}"] + hide_url_links = true # pro only +} +``` + +## Arguments Reference + +* `friendly_name` - friendly name of the monitor (for making it easier to distinguish from others). +* `monitors` - The monitors to be displayed. Use `[0]` for all monitors (default). +* `custom_domain` - (optional) the domain or subdomain that the status page will run on. +* `password` - (optional) the password for the status page. +* `sort` - (optional) the sorting of the status page. Can be one of the following: + - `a-z` + - `z-a` + - `up-down-paused` + - `down-up-paused` +* `status` - the status of the status page (`paused` or `active`). Defaults to `active` + + +## Attributes Reference + +* `id` - the ID of the status page +* `dns_address` - the dns address that you need to point your custom domain to (`stats.uptimerobot.com`) +* `standard_url` - the full url of the page on uptimerobot.com +* `custom_url` - the full url of the page (only if `custom_domain` is set) diff --git a/website/uptimerobot.erb b/website/uptimerobot.erb new file mode 100644 index 0000000..bad7253 --- /dev/null +++ b/website/uptimerobot.erb @@ -0,0 +1,43 @@ +<% wrap_layout :inner do %> + <% content_for :sidebar do %> +
+ <% end %> + + <%= yield %> +<% end %>