Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Fix required field for SLO widget #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions datadog/resource_datadog_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -2977,23 +2977,23 @@ func getServiceLevelObjectiveDefinitionSchema() map[string]*schema.Schema {
},
"view_type": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
"slo_id": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
"show_error_budget": {
Type: schema.TypeBool,
Optional: true,
},
"view_mode": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
"time_windows": {
Type: schema.TypeList,
Optional: true,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
}
Expand Down
18 changes: 9 additions & 9 deletions datadog/resource_datadog_dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func TestAccDatadogDashboard_update(t *testing.T) {
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "description", "Created using the Datadog provider in Terraform"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "layout_type", "ordered"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "is_read_only", "true"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.#", "13"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.#", "14"),
// Alert Graph widget
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.0.alert_graph_definition.0.alert_id", "895605"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.0.alert_graph_definition.0.viz_type", "timeseries"),
Expand Down Expand Up @@ -713,14 +713,14 @@ func TestAccDatadogDashboard_update(t *testing.T) {
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.12.group_definition.0.widget.1.alert_graph_definition.0.title", "Alert Graph"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.12.group_definition.0.widget.1.alert_graph_definition.0.time.live_span", "1h"),
// Service Level Objective widget
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.title", "Widget Title"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.view_type", "detail"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.slo_id", "56789"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.show_error_budget", "true"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.view_mode", "overall"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.time_windows.#", "2"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.time_windows.0", "7d"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.scatterplot_definition.0.time_windows.1", "previous_week"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.title", "Widget Title"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.view_type", "detail"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.slo_id", "56789"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.show_error_budget", "true"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.view_mode", "overall"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.time_windows.#", "2"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.time_windows.0", "7d"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "widget.13.service_level_objective_definition.0.time_windows.1", "previous_week"),
// Template Variables
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "template_variable.#", "2"),
resource.TestCheckResourceAttr("datadog_dashboard.ordered_dashboard", "template_variable.0.name", "var_1"),
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/dashboard.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,11 @@ Nested `widget` blocks have the following structure:
- `title_align`: (Optional) The alignment of the widget's title. One of "left", "center", or "right".
- `time`: (Optional) Nested block describing the timeframe to use when displaying the widget. The structure of this block is described [below](dashboard.html#nested-widget-time-blocks).
- `service_level_objective_definition`: The definition for a Service Level Objective widget. Exactly one nested block is allowed with the following structure:
- `view_type`: (Optional) Type of view to use when displaying the widget. Only "detail" is currently supported.
- `slo_id`: (Optional) The ID of the service level objective used by the widget.
- `view_type`: (Required) Type of view to use when displaying the widget. Only "detail" is currently supported.
- `slo_id`: (Required) The ID of the service level objective used by the widget.
- `show_error_budget`: (Optional) Whether to show the error budget or not.
- `view_mode`: (Optional) View mode for the widget. One of "overall", "component", or "both".
- `time_windows`: (Optional) List of time windows to display in the widget. Each value in the list must be one of "7d", "30d", "90d", "week_to_date", "previous_week", "month_to_date", or "previous_month".
- `view_mode`: (Required) View mode for the widget. One of "overall", "component", or "both".
- `time_windows`: (Required) List of time windows to display in the widget. Each value in the list must be one of "7d", "30d", "90d", "week_to_date", "previous_week", "month_to_date", or "previous_month".
- `title`: (Optional) The title of the widget.
- `title_size`: (Optional) The size of the widget's title. Default is 16.
- `title_align`: (Optional) The alignment of the widget's title. One of "left", "center", or "right".
Expand Down