From bee48ca2cf1b8845ee2657624810a28f7415b8d8 Mon Sep 17 00:00:00 2001 From: Arthur Hemery Date: Fri, 8 Nov 2024 14:28:18 +0100 Subject: [PATCH] Base working version --- .../fwprovider/resource_datadog_rum_metric.go | 30 +++++++++---------- docs/resources/rum_metric.md | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/datadog/fwprovider/resource_datadog_rum_metric.go b/datadog/fwprovider/resource_datadog_rum_metric.go index 0fe327924..78d8cc1d9 100644 --- a/datadog/fwprovider/resource_datadog_rum_metric.go +++ b/datadog/fwprovider/resource_datadog_rum_metric.go @@ -263,21 +263,6 @@ func (r *rumMetricResource) updateState(ctx context.Context, state *rumMetricMod state.EventType = types.StringValue(string(attributes.GetEventType())) - if groupBy, ok := attributes.GetGroupByOk(); ok && len(*groupBy) > 0 { - state.GroupBy = []*rumMetricGroupByModel{} - for _, groupByDdItem := range *groupBy { - groupByTfItem := rumMetricGroupByModel{} - if path, ok := groupByDdItem.GetPathOk(); ok { - groupByTfItem.Path = types.StringValue(*path) - } - if tagName, ok := groupByDdItem.GetTagNameOk(); ok { - groupByTfItem.TagName = types.StringValue(*tagName) - } - - state.GroupBy = append(state.GroupBy, &groupByTfItem) - } - } - if compute, ok := attributes.GetComputeOk(); ok { computeTf := rumMetricComputeModel{} @@ -306,6 +291,21 @@ func (r *rumMetricResource) updateState(ctx context.Context, state *rumMetricMod state.Filter = &filterTf } + if groupBy, ok := attributes.GetGroupByOk(); ok && len(*groupBy) > 0 { + state.GroupBy = []*rumMetricGroupByModel{} + for _, groupByDdItem := range *groupBy { + groupByTfItem := rumMetricGroupByModel{} + if path, ok := groupByDdItem.GetPathOk(); ok { + groupByTfItem.Path = types.StringValue(*path) + } + if tagName, ok := groupByDdItem.GetTagNameOk(); ok { + groupByTfItem.TagName = types.StringValue(*tagName) + } + + state.GroupBy = append(state.GroupBy, &groupByTfItem) + } + } + if uniqueness, ok := attributes.GetUniquenessOk(); ok { uniquenessTf := rumMetricUniquenessModel{} diff --git a/docs/resources/rum_metric.md b/docs/resources/rum_metric.md index 1e9c181bf..c7e00a212 100644 --- a/docs/resources/rum_metric.md +++ b/docs/resources/rum_metric.md @@ -47,7 +47,7 @@ resource "datadog_rum_metric" "foo" { - `compute` (Block, Optional) (see [below for nested schema](#nestedblock--compute)) - `filter` (Block, Optional) (see [below for nested schema](#nestedblock--filter)) -- `group_by` (Block List) (see [below for nested schema](#nestedblock--group_by)) +- `group_by` (Block Set) (see [below for nested schema](#nestedblock--group_by)) - `uniqueness` (Block, Optional) (see [below for nested schema](#nestedblock--uniqueness)) ### Read-Only