Skip to content

Commit

Permalink
Merge pull request #98 from logicmonitor/DEV-171165-ProviderFixAndAut…
Browse files Browse the repository at this point in the history
…oDiscoveryFeatureUpdate

Use Default Root and Website schema parameter fix
  • Loading branch information
lm-madhvi authored Jul 11, 2024
2 parents d8681b0 + 0ce1f2b commit 81cd08b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 4 deletions.
4 changes: 2 additions & 2 deletions logicmonitor/schemata/web_check_step_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func WebCheckStepSchema() map[string]*schema.Schema {

"use_default_root": {
Type: schema.TypeBool,
Optional: true,
Required: true,
},

}
Expand Down Expand Up @@ -247,7 +247,7 @@ func WebCheckStepModel(d map[string]interface{}) *models.WebCheckStep {
Timeout: timeout,
Type: typeVar,
URL: url,
UseDefaultRoot: useDefaultRoot,
UseDefaultRoot: &useDefaultRoot,
}
}

Expand Down
15 changes: 15 additions & 0 deletions logicmonitor/schemata/website_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func WebsiteSchema() map[string]*schema.Schema {
Optional: true,
},

"schema": {
Type: schema.TypeString,
Optional: true,
},

"status": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -254,6 +259,11 @@ func DataSourceWebsiteSchema() map[string]*schema.Schema {
Optional: true,
},

"schema": {
Type: schema.TypeString,
Optional: true,
},

"status": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -353,6 +363,7 @@ func SetWebsiteResourceData(d *schema.ResourceData, m *models.Website) {
d.Set("name", m.Name)
d.Set("overall_alert_level", m.OverallAlertLevel)
d.Set("polling_interval", m.PollingInterval)
d.Set("schema", m.Schema)
d.Set("status", m.Status)
d.Set("steps", SetWebCheckStepSubResourceData(m.Steps))
d.Set("stop_monitoring", m.StopMonitoring)
Expand Down Expand Up @@ -388,6 +399,7 @@ func SetWebsiteSubResourceData(m []*models.Website) (d []*map[string]interface{}
properties["name"] = website.Name
properties["overall_alert_level"] = website.OverallAlertLevel
properties["polling_interval"] = website.PollingInterval
properties["schema"] = website.Schema
properties["status"] = website.Status
properties["steps"] = SetWebCheckStepSubResourceData(website.Steps)
properties["stop_monitoring"] = website.StopMonitoring
Expand Down Expand Up @@ -423,6 +435,7 @@ func WebsiteModel(d *schema.ResourceData) *models.Website {
name := d.Get("name").(string)
overallAlertLevel := d.Get("overall_alert_level").(string)
pollingInterval := int32(d.Get("polling_interval").(int))
schema := d.Get("schema").(string)
steps := utils.GetPropFromSteps(d, "steps")
stopMonitoring := d.Get("stop_monitoring").(bool)
template := d.Get("template")
Expand Down Expand Up @@ -451,6 +464,7 @@ func WebsiteModel(d *schema.ResourceData) *models.Website {
Name: &name,
OverallAlertLevel: overallAlertLevel,
PollingInterval: pollingInterval,
Schema: schema,
Steps: steps,
StopMonitoring: stopMonitoring,
Template: template,
Expand Down Expand Up @@ -481,6 +495,7 @@ func GetWebsitePropertyFields() (t []string) {
"name",
"overall_alert_level",
"polling_interval",
"schema",
"steps",
"stop_monitoring",
"template",
Expand Down
2 changes: 1 addition & 1 deletion logicmonitor/utils/helper_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func getPropFromStepsInterface(r interface{}) (t []*models.WebCheckStep) {
Enable: enable,
Name: name,
Timeout: timeout,
UseDefaultRoot: useDefaultRoot,
UseDefaultRoot: &useDefaultRoot,
PostDataEditType: postDataEditType,
FullpageLoad: fullpageLoad,
RequireAuth: requireAuth,
Expand Down
17 changes: 16 additions & 1 deletion models/web_check_step.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions models/website.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions website/docs/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ resource "logicmonitor_website" "my_website" {
type = "pingcheck"
host = "google.com"
overall_alert_level = "warn"
schema = "http"
polling_interval = 5
description = "website test"
disable_alerting = true
Expand Down

0 comments on commit 81cd08b

Please sign in to comment.