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: 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_") {