-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[datadog_dashboard_list] Migrate to tf framework #2038
Conversation
…atasource-with-tf-framework
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great overall. However, we need to consider the issue #1979 . Previously, the sdk did not care about mismatch between state and config after a terraform action was performed but with this change, it will exit with Provider produced inconsistent result after apply
.
I think the best approach here is to modify the updateState methods to always use whatever the user supplied. Something like:
func (r *dashboardListResource) updateStateFromResponse(ctx context.Context, state *dashboardListResourceModel, dashboards []datadogV2.DashboardListItemResponse) {
temp := []*DashItemModel{}
for _, dashboard := range dashboards {
dashboardItem := DashItemModel{}
dashboardItem.Dash_id = types.StringValue(dashboard.GetId())
found := false
for _, v := range state.DashItem {
if v.Dash_id.ValueString() == dashboard.GetId() {
dashboardItem.Type = v.Type
found = true
}
}
if !found {
dashboardItem.Type = types.StringValue(string(dashboard.GetType()))
}
temp = append(temp, &dashboardItem)
}
state.DashItem = temp
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to be applied after #2042
NestedObject: schema.NestedBlockObject{ | ||
Attributes: map[string]schema.Attribute{ | ||
"type": schema.StringAttribute{ | ||
Description: "The type of this dashboard. Valid values are `custom_timeboard`, `custom_screenboard`, `integration_screenboard`, `integration_timeboard`, `host_timeboard`.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: "The type of this dashboard. Valid values are `custom_timeboard`, `custom_screenboard`, `integration_screenboard`, `integration_timeboard`, `host_timeboard`.", | |
Description: "The type of this dashboard.", |
…atasource-with-tf-framework
No description provided.