From 8fc63fe6874906def47f02dbfe69caaa9078972a Mon Sep 17 00:00:00 2001 From: Justin Moy Date: Thu, 28 Jan 2021 14:24:10 -0700 Subject: [PATCH 1/2] Provide SSL certificate verification options --- pingdom/resource_pingdom_check.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pingdom/resource_pingdom_check.go b/pingdom/resource_pingdom_check.go index b1a59bfb..7e571dd2 100644 --- a/pingdom/resource_pingdom_check.go +++ b/pingdom/resource_pingdom_check.go @@ -181,6 +181,16 @@ func resourcePingdomCheck() *schema.Resource { Optional: true, ForceNew: false, }, + "verifycertificate": { + Type: schema.TypeBool, + Optional: true, + ForceNew: false, + }, + "ssldowndaysbefore": { + Type: schema.TypeInt, + Optional: true, + ForceNew: false, + }, }, } } @@ -210,6 +220,8 @@ type commonCheckParams struct { ProbeFilters string StringToSend string StringToExpect string + VerifyCertificate bool + SSLDownDaysBefore int } func sortString(input string, seperator string) string { @@ -335,6 +347,14 @@ func checkForResource(d *schema.ResourceData) (pingdom.Check, error) { checkParams.StringToExpect = v.(string) } + if v, ok := d.GetOk("verifycertificate"); ok { + checkParams.VerifyCertificate = v.(bool) + } + + if v, ok := d.GetOk("ssldowndaysbefore"); ok { + checkParams.SSLDownDaysBefore = v.(int) + } + checkType := d.Get("type") switch checkType { case "http": @@ -361,6 +381,8 @@ func checkForResource(d *schema.ResourceData) (pingdom.Check, error) { ProbeFilters: checkParams.ProbeFilters, UserIds: checkParams.UserIds, TeamIds: checkParams.TeamIds, + VerifyCertificate: &checkParams.VerifyCertificate, + SSLDownDaysBefore: &checkParams.SSLDownDaysBefore, }, nil case "ping": return &pingdom.PingCheck{ @@ -565,6 +587,12 @@ func resourcePingdomCheckRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("postdata", ck.Type.HTTP.PostData); err != nil { return err } + if err := d.Set("verifycertificate", ck.Type.HTTP.VerifyCertificate); err != nil { + return err + } + if err := d.Set("ssldowndaysbefore", ck.Type.HTTP.SSLDownDaysBefore); err != nil { + return err + } if v, ok := ck.Type.HTTP.RequestHeaders["User-Agent"]; ok { if strings.HasPrefix(v, "Pingdom.com_bot_version_") { From 25c4b71a9342986520004dbdf79e4e2f4b4726f4 Mon Sep 17 00:00:00 2001 From: Justin Moy Date: Thu, 28 Jan 2021 14:29:40 -0700 Subject: [PATCH 2/2] Update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index babd580c..5b9fffb5 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,10 @@ For the HTTP checks, you can set these attributes: * **probefilters** - Region from which the check should originate. One of NA, EU, APAC, or LATAM. Should be in the format "region:NA" + * **verifycertificate** - Enable monitoring of SSL/TLS certificate. + + * **ssldowndaysbefore** - Days prior to certificate expiring to consider down. + #### TCP specific attributes #### For the TCP checks, you can set these attributes: