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 ++++ 2 files changed, 15 insertions(+) (limited to 'statuscake') 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 } ` -- cgit v1.2.3