Skip to content

Commit 648a4ef

Browse files
[Dashboards] Fix is_column_break issues (#1140)
* Fix is_column_break not saving in state, causing infinite apply * Update cassettes * Add reflow_type and column_break tests
1 parent 4f91a05 commit 648a4ef

File tree

62 files changed

+1490
-1721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1490
-1721
lines changed

datadog/resource_datadog_dashboard.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,18 @@ func buildTerraformWidget(datadogWidget datadogV1.Widget, k *utils.ResourceDataK
987987

988988
// Build layout
989989
if v, ok := datadogWidget.GetLayoutOk(); ok {
990-
terraformWidget["widget_layout"] = []map[string]int64{{
990+
widgetLayout := map[string]interface{}{
991991
"x": (*v).GetX(),
992992
"y": (*v).GetY(),
993993
"height": (*v).GetHeight(),
994994
"width": (*v).GetWidth(),
995-
}}
995+
}
996+
if value, ok := (*v).GetIsColumnBreakOk(); ok {
997+
widgetLayout["is_column_break"] = value
998+
}
999+
terraformWidget["widget_layout"] = [](map[string]interface{}){
1000+
widgetLayout,
1001+
}
9961002
}
9971003
terraformWidget["id"] = datadogWidget.GetId()
9981004

@@ -1136,7 +1142,7 @@ func buildDatadogWidgetLayout(terraformLayout map[string]interface{}) *datadogV1
11361142
datadogLayout.SetY(int64(terraformLayout["y"].(int)))
11371143
datadogLayout.SetHeight(int64(terraformLayout["height"].(int)))
11381144
datadogLayout.SetWidth(int64(terraformLayout["width"].(int)))
1139-
if value, ok := terraformLayout["is_column_break"].(bool); ok {
1145+
if value, ok := terraformLayout["is_column_break"].(bool); ok && value {
11401146
datadogLayout.SetIsColumnBreak(value)
11411147
}
11421148
return datadogLayout
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-05-19T19:45:39.34159-04:00
1+
2021-07-12T11:25:24.046699+02:00

datadog/tests/cassettes/TestAccDatadogDashboardEventStream.yaml

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 1
33
interactions:
44
- request:
55
body: |
6-
{"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"free","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","widgets":[{"definition":{"event_size":"l","query":"*","tags_execution":"and","time":{"live_span":"4h"},"title":"Widget Title","title_align":"right","title_size":"16","type":"event_stream"},"layout":{"height":43,"is_column_break":false,"width":32,"x":5,"y":5}}]}
6+
{"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"free","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","widgets":[{"definition":{"event_size":"l","query":"*","tags_execution":"and","time":{"live_span":"4h"},"title":"Widget Title","title_align":"right","title_size":"16","type":"event_stream"},"layout":{"height":43,"width":32,"x":5,"y":5}}]}
77
form: {}
88
headers:
99
Accept:
@@ -13,11 +13,11 @@ interactions:
1313
Dd-Operation-Id:
1414
- CreateDashboard
1515
User-Agent:
16-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
16+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
1717
url: https://api.datadoghq.com/api/v1/dashboard
1818
method: POST
1919
response:
20-
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
20+
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
2121
headers:
2222
Cache-Control:
2323
- no-cache
@@ -28,7 +28,7 @@ interactions:
2828
Content-Type:
2929
- application/json
3030
Date:
31-
- Wed, 19 May 2021 23:45:43 GMT
31+
- Mon, 12 Jul 2021 09:25:29 GMT
3232
Pragma:
3333
- no-cache
3434
Strict-Transport-Security:
@@ -37,10 +37,6 @@ interactions:
3737
- Accept-Encoding
3838
X-Content-Type-Options:
3939
- nosniff
40-
X-Dd-Debug:
41-
- SY1h8ScsWq+kYmtbh63ltMLFAZsQjqfrgvdfAoRX+9TzT1sgMBRYaFRwfWWRRe9a
42-
X-Dd-Version:
43-
- "35.4569410"
4440
X-Frame-Options:
4541
- SAMEORIGIN
4642
status: 200 OK
@@ -55,11 +51,11 @@ interactions:
5551
Dd-Operation-Id:
5652
- GetDashboard
5753
User-Agent:
58-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
59-
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
54+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
55+
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
6056
method: GET
6157
response:
62-
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
58+
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
6359
headers:
6460
Cache-Control:
6561
- no-cache
@@ -70,7 +66,7 @@ interactions:
7066
Content-Type:
7167
- application/json
7268
Date:
73-
- Wed, 19 May 2021 23:45:43 GMT
69+
- Mon, 12 Jul 2021 09:25:29 GMT
7470
Pragma:
7571
- no-cache
7672
Strict-Transport-Security:
@@ -79,10 +75,6 @@ interactions:
7975
- Accept-Encoding
8076
X-Content-Type-Options:
8177
- nosniff
82-
X-Dd-Debug:
83-
- LcgNasIYBRkNppmD6mCKE9J6iv0eEjosuuHR5V5zw2fWbR54i39C8dhdK8zDq/40
84-
X-Dd-Version:
85-
- "35.4569410"
8678
X-Frame-Options:
8779
- SAMEORIGIN
8880
status: 200 OK
@@ -97,11 +89,11 @@ interactions:
9789
Dd-Operation-Id:
9890
- GetDashboard
9991
User-Agent:
100-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
101-
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
92+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
93+
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
10294
method: GET
10395
response:
104-
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
96+
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
10597
headers:
10698
Cache-Control:
10799
- no-cache
@@ -112,7 +104,7 @@ interactions:
112104
Content-Type:
113105
- application/json
114106
Date:
115-
- Wed, 19 May 2021 23:45:43 GMT
107+
- Mon, 12 Jul 2021 09:25:29 GMT
116108
Pragma:
117109
- no-cache
118110
Strict-Transport-Security:
@@ -121,10 +113,6 @@ interactions:
121113
- Accept-Encoding
122114
X-Content-Type-Options:
123115
- nosniff
124-
X-Dd-Debug:
125-
- dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU
126-
X-Dd-Version:
127-
- "35.4569410"
128116
X-Frame-Options:
129117
- SAMEORIGIN
130118
status: 200 OK
@@ -139,11 +127,11 @@ interactions:
139127
Dd-Operation-Id:
140128
- GetDashboard
141129
User-Agent:
142-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
143-
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
130+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
131+
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
144132
method: GET
145133
response:
146-
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
134+
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
147135
headers:
148136
Cache-Control:
149137
- no-cache
@@ -154,7 +142,7 @@ interactions:
154142
Content-Type:
155143
- application/json
156144
Date:
157-
- Wed, 19 May 2021 23:45:44 GMT
145+
- Mon, 12 Jul 2021 09:25:30 GMT
158146
Pragma:
159147
- no-cache
160148
Strict-Transport-Security:
@@ -163,10 +151,6 @@ interactions:
163151
- Accept-Encoding
164152
X-Content-Type-Options:
165153
- nosniff
166-
X-Dd-Debug:
167-
- 5gfwVh/5HZ+AnGd/Di93w3NEWC6KMHT9KzmHEiRJmNdOjBtAsbOcgVFyqEChw71h
168-
X-Dd-Version:
169-
- "35.4569410"
170154
X-Frame-Options:
171155
- SAMEORIGIN
172156
status: 200 OK
@@ -181,11 +165,11 @@ interactions:
181165
Dd-Operation-Id:
182166
- DeleteDashboard
183167
User-Agent:
184-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
185-
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
168+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
169+
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
186170
method: DELETE
187171
response:
188-
body: '{"deleted_dashboard_id":"hgw-kkx-56n"}'
172+
body: '{"deleted_dashboard_id":"p4i-69v-wza"}'
189173
headers:
190174
Cache-Control:
191175
- no-cache
@@ -196,7 +180,7 @@ interactions:
196180
Content-Type:
197181
- application/json
198182
Date:
199-
- Wed, 19 May 2021 23:45:45 GMT
183+
- Mon, 12 Jul 2021 09:25:31 GMT
200184
Pragma:
201185
- no-cache
202186
Strict-Transport-Security:
@@ -205,10 +189,6 @@ interactions:
205189
- Accept-Encoding
206190
X-Content-Type-Options:
207191
- nosniff
208-
X-Dd-Debug:
209-
- nLnnBNvlCFDECRnZvzDb0z4sAO35G+IMidcAs8vrCKyjvsKWE8Yd9S3n6OjZ1qRN
210-
X-Dd-Version:
211-
- "35.4569410"
212192
X-Frame-Options:
213193
- SAMEORIGIN
214194
status: 200 OK
@@ -223,11 +203,11 @@ interactions:
223203
Dd-Operation-Id:
224204
- GetDashboard
225205
User-Agent:
226-
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
227-
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
206+
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
207+
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
228208
method: GET
229209
response:
230-
body: '{"errors": ["Dashboard with ID hgw-kkx-56n not found"]}'
210+
body: '{"errors": ["Dashboard with ID p4i-69v-wza not found"]}'
231211
headers:
232212
Cache-Control:
233213
- no-cache
@@ -238,7 +218,7 @@ interactions:
238218
Content-Type:
239219
- application/json
240220
Date:
241-
- Wed, 19 May 2021 23:45:45 GMT
221+
- Mon, 12 Jul 2021 09:25:32 GMT
242222
Pragma:
243223
- no-cache
244224
Strict-Transport-Security:
@@ -247,8 +227,6 @@ interactions:
247227
- Accept-Encoding
248228
X-Content-Type-Options:
249229
- nosniff
250-
X-Dd-Version:
251-
- "35.4569410"
252230
X-Frame-Options:
253231
- SAMEORIGIN
254232
status: 404 Not Found
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-05-19T19:45:39.34166-04:00
1+
2021-07-12T11:25:24.046699+02:00

0 commit comments

Comments
 (0)