diff --git a/docs/resources/monitor.md b/docs/resources/monitor.md index 838628b..4cd6d23 100644 --- a/docs/resources/monitor.md +++ b/docs/resources/monitor.md @@ -34,10 +34,14 @@ resource "statusflare_monitor" "example" { ### Optional - **expect_status** (Number) The expected HTTP status code. The default is 200. +- **follow_redirects** (Boolean) +- **insecure_skip_verify** (Boolean) - **integrations** (List of String) IDs of integrations attached to this monitor. +- **interval** (Number) Check interval in seconds. - **method** (String) The HTTP method. The default is 'GET'. - **retries** (Number) Retries or also 'notify_after' field in API. The default is 1. - **scheme** (String) The scheme might be http or https. The default value is https. +- **timeout** (Number) Timeout interval in seconds. - **worker** (String) ID of the worker to perform checks from. The default is 'managed'. ### Read-Only diff --git a/internal/provider/resource_monitor.go b/internal/provider/resource_monitor.go index e8d4f29..ddc35ee 100644 --- a/internal/provider/resource_monitor.go +++ b/internal/provider/resource_monitor.go @@ -63,6 +63,27 @@ func resourceMonitor() *schema.Resource { }, Description: "IDs of integrations attached to this monitor.", }, + "follow_redirects": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "insecure_skip_verify": { + Type: schema.TypeBool, + Optional: true, + }, + "timeout": { + Type: schema.TypeInt, + Default: 30, + Optional: true, + Description: "Timeout interval in seconds.", + }, + "interval": { + Type: schema.TypeInt, + Default: 300, + Optional: true, + Description: "Check interval in seconds.", + }, } return &schema.Resource{ @@ -149,6 +170,10 @@ func dataToMonitor(src *schema.ResourceData, dst *statusflare.Monitor) { dst.NotifyAfter = src.Get("retries").(int) dst.Worker = src.Get("worker").(string) dst.Integrations = toStrArray(src.Get("integrations").([]interface{})) + dst.FollowRedirects = src.Get("follow_redirects").(bool) + dst.InsecureSkipVerify = src.Get("insecure_skip_verify").(bool) + dst.Timeout = src.Get("timeout").(int) + dst.Interval = src.Get("interval").(int) } func monitorToData(src *statusflare.Monitor, dst *schema.ResourceData) { @@ -160,4 +185,8 @@ func monitorToData(src *statusflare.Monitor, dst *schema.ResourceData) { dst.Set("worker", src.Worker) dst.Set("retries", src.NotifyAfter) dst.Set("integrations", src.Integrations) + dst.Set("follow_redirects", src.FollowRedirects) + dst.Set("insecure_skip_verify", src.InsecureSkipVerify) + dst.Set("timeout", src.Timeout) + dst.Set("interval", src.Interval) } diff --git a/statusflare/monitor.go b/statusflare/monitor.go index 5387fc9..b620d5c 100644 --- a/statusflare/monitor.go +++ b/statusflare/monitor.go @@ -6,15 +6,19 @@ import ( ) type Monitor struct { - Id string `json:"id"` - Name string `json:"name"` - URL string `json:"url"` - Scheme string `json:"schema"` // not sure if it's typo in API, but I'm using Scheme here - Method string `json:"method"` - ExpectStatus int `json:"expect_status"` - NotifyAfter int `json:"notify_after"` - Worker string `json:"worker"` - Integrations []string `json:"integrations"` + Id string `json:"id"` + Name string `json:"name"` + URL string `json:"url"` + Scheme string `json:"schema"` // not sure if it's typo in API, but I'm using Scheme here + Method string `json:"method"` + ExpectStatus int `json:"expect_status"` + NotifyAfter int `json:"notify_after"` + Worker string `json:"worker"` + Integrations []string `json:"integrations"` + FollowRedirects bool `json:"follow_redirects"` + InsecureSkipVerify bool `json:"insecure_skip_verify"` + Timeout int `json:"timeout"` + Interval int `json:"interval"` } // create new monitor