diff options
author | Ivan Schwarz <ivos.schwarz@gmail.com> | 2019-06-14 15:55:36 +0200 |
---|---|---|
committer | Ivan Schwarz <ivos.schwarz@gmail.com> | 2019-06-14 15:55:36 +0200 |
commit | 31ca64bb28cb66f0b41661afe66b6811254ef09e (patch) | |
tree | c11962f795e99be533cebfda5023b38e2e2ef659 | |
parent | 24c95871c559e4d0a284f4c245d6e7afaeb5b9a7 (diff) | |
download | terraform-provider-statuscake-31ca64bb28cb66f0b41661afe66b6811254ef09e.tar.gz terraform-provider-statuscake-31ca64bb28cb66f0b41661afe66b6811254ef09e.tar.zst terraform-provider-statuscake-31ca64bb28cb66f0b41661afe66b6811254ef09e.zip |
Add enable_ssl_alert feature for uptime tests
-rw-r--r-- | statuscake/resource_statuscaketest.go | 11 | ||||
-rw-r--r-- | statuscake/resource_statuscaketest_test.go | 4 | ||||
-rw-r--r-- | 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 { | |||
215 | Optional: true, | 215 | Optional: true, |
216 | }, | 216 | }, |
217 | 217 | ||
218 | "enable_ssl_alert": { | ||
219 | Type: schema.TypeBool, | ||
220 | Optional: true, | ||
221 | Default: false, | ||
222 | }, | ||
223 | |||
218 | "follow_redirect": { | 224 | "follow_redirect": { |
219 | Type: schema.TypeBool, | 225 | Type: schema.TypeBool, |
220 | Optional: true, | 226 | Optional: true, |
@@ -257,6 +263,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { | |||
257 | UseJar: d.Get("use_jar").(int), | 263 | UseJar: d.Get("use_jar").(int), |
258 | PostRaw: d.Get("post_raw").(string), | 264 | PostRaw: d.Get("post_raw").(string), |
259 | FinalEndpoint: d.Get("final_endpoint").(string), | 265 | FinalEndpoint: d.Get("final_endpoint").(string), |
266 | EnableSSLAlert: d.Get("enable_ssl_alert").(bool), | ||
260 | FollowRedirect: d.Get("follow_redirect").(bool), | 267 | FollowRedirect: d.Get("follow_redirect").(bool), |
261 | } | 268 | } |
262 | 269 | ||
@@ -354,6 +361,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error { | |||
354 | d.Set("use_jar", testResp.UseJar) | 361 | d.Set("use_jar", testResp.UseJar) |
355 | d.Set("post_raw", testResp.PostRaw) | 362 | d.Set("post_raw", testResp.PostRaw) |
356 | d.Set("final_endpoint", testResp.FinalEndpoint) | 363 | d.Set("final_endpoint", testResp.FinalEndpoint) |
364 | d.Set("enable_ssl_alert", testResp.EnableSSLAlert) | ||
357 | d.Set("follow_redirect", testResp.FollowRedirect) | 365 | d.Set("follow_redirect", testResp.FollowRedirect) |
358 | 366 | ||
359 | return nil | 367 | return nil |
@@ -456,6 +464,9 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { | |||
456 | if v, ok := d.GetOk("final_endpoint"); ok { | 464 | if v, ok := d.GetOk("final_endpoint"); ok { |
457 | test.FinalEndpoint = v.(string) | 465 | test.FinalEndpoint = v.(string) |
458 | } | 466 | } |
467 | if v, ok := d.GetOk("enable_ssl_alert"); ok { | ||
468 | test.EnableSSLAlert = v.(bool) | ||
469 | } | ||
459 | if v, ok := d.GetOk("follow_redirect"); ok { | 470 | if v, ok := d.GetOk("follow_redirect"); ok { |
460 | test.FollowRedirect = v.(bool) | 471 | test.FollowRedirect = v.(bool) |
461 | } | 472 | } |
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) { | |||
114 | resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), | 114 | resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), |
115 | resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), | 115 | resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), |
116 | resource.TestCheckResourceAttr("statuscake_test.google", "final_endpoint", "string10781"), | 116 | resource.TestCheckResourceAttr("statuscake_test.google", "final_endpoint", "string10781"), |
117 | resource.TestCheckResourceAttr("statuscake_test.google", "enable_ssl_alert", "false"), | ||
117 | resource.TestCheckResourceAttr("statuscake_test.google", "follow_redirect", "true"), | 118 | resource.TestCheckResourceAttr("statuscake_test.google", "follow_redirect", "true"), |
118 | ), | 119 | ), |
119 | }, | 120 | }, |
@@ -213,6 +214,8 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC | |||
213 | err = check(key, value, test.PostRaw) | 214 | err = check(key, value, test.PostRaw) |
214 | case "final_endpoint": | 215 | case "final_endpoint": |
215 | err = check(key, value, test.FinalEndpoint) | 216 | err = check(key, value, test.FinalEndpoint) |
217 | case "enable_ssl_alert": | ||
218 | err = check(key, value, strconv.FormatBool(test.EnableSSLAlert)) | ||
216 | case "follow_redirect": | 219 | case "follow_redirect": |
217 | err = check(key, value, strconv.FormatBool(test.FollowRedirect)) | 220 | err = check(key, value, strconv.FormatBool(test.FollowRedirect)) |
218 | } | 221 | } |
@@ -297,6 +300,7 @@ resource "statuscake_test" "google" { | |||
297 | use_jar = 1 | 300 | use_jar = 1 |
298 | post_raw = "string32096" | 301 | post_raw = "string32096" |
299 | final_endpoint = "string10781" | 302 | final_endpoint = "string10781" |
303 | enable_ssl_alert = false | ||
300 | follow_redirect = true | 304 | follow_redirect = true |
301 | } | 305 | } |
302 | ` | 306 | ` |
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: | |||
29 | * `website_name` - (Required) This is the name of the test and the website to be monitored. | 29 | * `website_name` - (Required) This is the name of the test and the website to be monitored. |
30 | * `website_url` - (Required) The URL of the website to be monitored | 30 | * `website_url` - (Required) The URL of the website to be monitored |
31 | * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 | 31 | * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 |
32 | * `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. | 32 | * `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. |
33 | * `contact_group` - (Optional) Set test contact groups, must be array of strings. | 33 | * `contact_group` - (Optional) Set test contact groups, must be array of strings. |
34 | * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS | 34 | * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS |
35 | * `paused` - (Optional) Whether or not the test is paused. Defaults to false. | 35 | * `paused` - (Optional) Whether or not the test is paused. Defaults to false. |
36 | * `timeout` - (Optional) The timeout of the test in seconds. | 36 | * `timeout` - (Optional) The timeout of the test in seconds. |
@@ -56,6 +56,7 @@ The following arguments are supported: | |||
56 | * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. | 56 | * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. |
57 | * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. | 57 | * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. |
58 | * `final_endpoint` - (Optional) Use to specify the expected Final URL in the testing process. | 58 | * `final_endpoint` - (Optional) Use to specify the expected Final URL in the testing process. |
59 | * `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 | ||
59 | * `follow_redirect` - (Optional) Use to specify whether redirects should be followed, set to true to enable. Default is false. | 60 | * `follow_redirect` - (Optional) Use to specify whether redirects should be followed, set to true to enable. Default is false. |
60 | 61 | ||
61 | ## Attributes Reference | 62 | ## Attributes Reference |