From 31ca64bb28cb66f0b41661afe66b6811254ef09e Mon Sep 17 00:00:00 2001 From: Ivan Schwarz Date: Fri, 14 Jun 2019 15:55:36 +0200 Subject: Add enable_ssl_alert feature for uptime tests --- statuscake/resource_statuscaketest.go | 11 +++++++++++ statuscake/resource_statuscaketest_test.go | 4 ++++ website/docs/r/test.html.markdown | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go index b062456..d32a870 100644 --- a/statuscake/resource_statuscaketest.go +++ b/statuscake/resource_statuscaketest.go @@ -215,6 +215,12 @@ func resourceStatusCakeTest() *schema.Resource { Optional: true, }, + "enable_ssl_alert": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "follow_redirect": { Type: schema.TypeBool, Optional: true, @@ -257,6 +263,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { UseJar: d.Get("use_jar").(int), PostRaw: d.Get("post_raw").(string), FinalEndpoint: d.Get("final_endpoint").(string), + EnableSSLAlert: d.Get("enable_ssl_alert").(bool), FollowRedirect: d.Get("follow_redirect").(bool), } @@ -354,6 +361,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error { d.Set("use_jar", testResp.UseJar) d.Set("post_raw", testResp.PostRaw) d.Set("final_endpoint", testResp.FinalEndpoint) + d.Set("enable_ssl_alert", testResp.EnableSSLAlert) d.Set("follow_redirect", testResp.FollowRedirect) return nil @@ -456,6 +464,9 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { if v, ok := d.GetOk("final_endpoint"); ok { test.FinalEndpoint = v.(string) } + if v, ok := d.GetOk("enable_ssl_alert"); ok { + test.EnableSSLAlert = v.(bool) + } if v, ok := d.GetOk("follow_redirect"); ok { test.FollowRedirect = v.(bool) } diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go index bd609d8..71362f7 100644 --- a/statuscake/resource_statuscaketest_test.go +++ b/statuscake/resource_statuscaketest_test.go @@ -114,6 +114,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) { resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), resource.TestCheckResourceAttr("statuscake_test.google", "final_endpoint", "string10781"), + resource.TestCheckResourceAttr("statuscake_test.google", "enable_ssl_alert", "false"), resource.TestCheckResourceAttr("statuscake_test.google", "follow_redirect", "true"), ), }, @@ -213,6 +214,8 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC err = check(key, value, test.PostRaw) case "final_endpoint": err = check(key, value, test.FinalEndpoint) + case "enable_ssl_alert": + err = check(key, value, strconv.FormatBool(test.EnableSSLAlert)) case "follow_redirect": err = check(key, value, strconv.FormatBool(test.FollowRedirect)) } @@ -297,6 +300,7 @@ resource "statuscake_test" "google" { use_jar = 1 post_raw = "string32096" final_endpoint = "string10781" + enable_ssl_alert = false follow_redirect = true } ` diff --git a/website/docs/r/test.html.markdown b/website/docs/r/test.html.markdown index 6c65f10..f5cc5e0 100644 --- a/website/docs/r/test.html.markdown +++ b/website/docs/r/test.html.markdown @@ -29,8 +29,8 @@ The following arguments are supported: * `website_name` - (Required) This is the name of the test and the website to be monitored. * `website_url` - (Required) The URL of the website to be monitored * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 -* `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. -* `contact_group` - (Optional) Set test contact groups, must be array of strings. +* `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. +* `contact_group` - (Optional) Set test contact groups, must be array of strings. * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS * `paused` - (Optional) Whether or not the test is paused. Defaults to false. * `timeout` - (Optional) The timeout of the test in seconds. @@ -56,6 +56,7 @@ The following arguments are supported: * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. * `final_endpoint` - (Optional) Use to specify the expected Final URL in the testing process. +* `enable_ssl_alert` - (Optional) HTTP Tests only. If enabled, tests will send warnings if the SSL certificate is about to expire. Paid users only. Default is false * `follow_redirect` - (Optional) Use to specify whether redirects should be followed, set to true to enable. Default is false. ## Attributes Reference -- cgit v1.2.3