GroupWidgetDefinition is not working in CDKTF datadog for creating widget grops

I am working on creating some widgets of DD using CDKTF Datadog GO provider. I am not able to create a group widget using the struct DashboardWidgetGroupDefinition. If I add the slice of objects with this struct then it is not working however normal widgets work. Can anyone help me on this?

This is the core code for dashboard with DashboardWidgetGroupDefinition:

datadog.NewDashboard(stack, jsii.String("TerraformTest"), &datadog.DashboardConfig{
    Title:      jsii.String("Terraform Test Dashboard with Group"),
    LayoutType: jsii.String("ordered"),
    Widget: []datadog.DashboardWidgetGroupDefinition{
        {
            LayoutType: jsii.String("ordered"),
            Title:      jsii.String("CDKTF Group Widget"),
            Widget:     []datadog.DashboardWidget{testWidget},
        },
    },
})

This is how the widget Definition looks like:

widget := datadog.DashboardWidgetTimeseriesDefinition{
		Title: jsii.String("Testing"),
		Request: []datadog.DashboardWidgetTimeseriesDefinitionRequest{
			{
				Q:           jsii.String("query"),
				DisplayType: jsii.String("line"),
			},
		},
		Event: []datadog.DashboardWidgetTimeseriesDefinitionEvent{
			{
				Q: jsii.String("query"),
			},
		},
	}

	testWidget := datadog.DashboardWidget{}
	testWidget.TimeseriesDefinition = &widget

above code results into blank list of Widgets

@schapirama Can you please help here? Tagging you since you appear to be using GO bindings for cdktf @apparentlymart if you can help as well

This is resolved. I figured out that I had to assign the GroupDefinition to Widgets and not the other way around. so the code for timeseries Widget creation goes like below:

widget := datadog.DashboardWidgetTimeseriesDefinition{
		Title: jsii.String("Testing"),
		Request: []datadog.DashboardWidgetTimeseriesDefinitionRequest{
			{
				Q:           jsii.String("query"),
				DisplayType: jsii.String("line"),
			},
		},
		Event: []datadog.DashboardWidgetTimeseriesDefinitionEvent{
			{
				Q: jsii.String("query"),
			},
		},
	}

	testWidget := datadog.DashboardWidget{}
	testWidget.TimeseriesDefinition = &widget

	groupDefinition := datadog.DashboardWidgetGroupDefinition{
		LayoutType: jsii.String("ordered"),
		Title:      jsii.String("CDKTF Group Widget"),
               Widget:     []datadog.DashboardWidget{testWidget},
	}
	finalWidget := datadog.DashboardWidget{
		GroupDefinition: &groupDefinition,
	}

     datadog.NewDashboard(stack, jsii.String("TerraformTest"), &datadog.DashboardConfig{
		Title:            jsii.String("Terraform Test Dashboard with Group from GO"),
		LayoutType:       jsii.String("ordered"),
		Widget:           []datadog.DashboardWidget{finalWidget},
	})
1 Like