Skip to content

Commit

Permalink
Merge pull request #106 from StatusCakeDev/set-icmp-block-when-importing
Browse files Browse the repository at this point in the history
Set the ICMP block when importing an uptime check
  • Loading branch information
tomasbasham authored Dec 16, 2022
2 parents f2e9643 + 6d8af3b commit 36f9c47
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/provider/resource_uptime_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ func resourceStatusCakeUptimeCheckRead(ctx context.Context, d *schema.ResourceDa
return diag.Errorf("failed to read HTTP check: %s", err)
}

if err := d.Set("icmp_check", flattenUptimeCheckICMPCheck(res.Data, d)); err != nil {
return diag.Errorf("failed to read ICMP check: %s", err)
}

if err := d.Set("monitored_resource", flattenUptimeCheckMonitoredResource(res.Data, d)); err != nil {
return diag.Errorf("failed to read monitored resource: %s", err)
}
Expand Down Expand Up @@ -1005,7 +1009,16 @@ func expandUptimeCheckICMPCheck(v interface{}, d *schema.ResourceData) (interfac
}

func flattenUptimeCheckICMPCheck(v interface{}, d *schema.ResourceData) interface{} {
return []interface{}{}
data := v.(statuscake.UptimeTest)
if data.TestType != statuscake.UptimeTestTypePING {
return nil
}

return []map[string]interface{}{
map[string]interface{}{
"enabled": true,
},
}
}

func expandUptimeCheckIncludeHeaders(v interface{}, d *schema.ResourceData) (interface{}, error) {
Expand Down

0 comments on commit 36f9c47

Please sign in to comment.