]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/commitdiff
Add enable_ssl_alert feature for uptime tests
authorIvan Schwarz <ivos.schwarz@gmail.com>
Fri, 14 Jun 2019 13:55:36 +0000 (15:55 +0200)
committerIvan Schwarz <ivos.schwarz@gmail.com>
Fri, 14 Jun 2019 13:55:36 +0000 (15:55 +0200)
statuscake/resource_statuscaketest.go
statuscake/resource_statuscaketest_test.go
website/docs/r/test.html.markdown

index b062456ae5140b72ec588a6c42c4a67a1e39ef5c..d32a870e935313a50d41c67874fd89f8300f3581 100644 (file)
@@ -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)
        }
index bd609d84038a681dd7235b0d01c516189f843438..71362f7d67aae42d9527cb90354961697bfb8f95 100644 (file)
@@ -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
 }
 `
index 6c65f1004ab76110671e3c1f20fe68e1af3c7782..f5cc5e052de787d0556e15104ec835aa5e310739 100644 (file)
@@ -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