hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.79k stars 443 forks source link

spansMetric.SpansMetric construct has a bug (Compute object is not supported) #3570

Closed TirushV closed 3 months ago

TirushV commented 3 months ago

Expected Behavior

export interface SpansMetricConfig extends cdktf.TerraformMetaArguments {
    /**
    * The name of the span-based metric. This field can't be updated after creation.
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#name SpansMetric#name}
    */
    readonly name: string;
    /**
    * filter block
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#filter SpansMetric#filter}
    */
    readonly filter?: SpansMetricFilter;
    /**
    * group_by block
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#group_by SpansMetric#group_by}
    */
    readonly groupBy?: SpansMetricGroupBy[] | cdktf.IResolvable;
}

Actual Behavior

export interface SpansMetricConfig extends cdktf.TerraformMetaArguments {
    /**
    * The name of the span-based metric. This field can't be updated after creation.
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#name SpansMetric#name}
    */
    readonly name: string;
    /**
    * filter block
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#filter SpansMetric#filter}
    */
    readonly filter?: SpansMetricFilter;
    /**
    * group_by block
    *
    * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/datadog/datadog/3.38.0/docs/resources/spans_metric#group_by SpansMetric#group_by}
    */
    readonly groupBy?: SpansMetricGroupBy[] | cdktf.IResolvable;
    readonly compute: SpansMetricCompute;
}

Steps to Reproduce

We need to add this line in order to support compute objects and attribute to create span metric with cdk terraform datadog.

readonly compute: SpansMetricCompute;

Versions

language: typescript
cdktf: 0.20.3
terraform: Terraform v1.7.2
macos: Macbook m2 pro

Providers

No response

Gist

No response

Possible Solutions

readonly compute: SpansMetricCompute;

If we had this line we can pass the compute attribute to create the span metric via cdk terraform datadog.

Workarounds

No response

Anything Else?

Please try solving this ASAP. Thank you

References

No response

Help Wanted

Community Note

I tried adding that suggested line in my local but getting below error with and without

⠹  Processing
[2024-03-28T22:36:12.096] [ERROR] default - ╷
│ Error: Invalid Block
│
│   with datadog_spans_metric.stubio_timeTakenInSeconds_custom_metrics_stubio-timeTakenInSeconds_5AA15605,
│   on cdk.tf.json line 627, in resource.datadog_spans_metric.stubio_timeTakenInSeconds_custom_metrics_stubio-timeTakenInSeconds_5AA15605:
│  627:       }
│
│ Block compute must have a configuration value as the provider has marked it
│ as required
dev-Stubio  ╷
            │ Error: Invalid Block
            │
            │   with datadog_spans_metric.stubio_timeTakenInSeconds_custom_metrics_stubio-timeTakenInSeconds_5AA15605 (stubio_timeTakenInSeconds_custom_metrics/stubio-timeTakenInSeconds),
            │   on cdk.tf.json line 627, in resource.datadog_spans_metric.stubio_timeTakenInSeconds_custom_metrics_stubio-timeTakenInSeconds_5AA15605 (stubio_timeTakenInSeconds_custom_metrics/stubio-timeTakenInSeconds):
            │  627:       }
            │
            │ Block compute must have a configuration value as the provider has marked it
            │ as required
            ╵
TirushV commented 3 months ago

Hi Team, Any update?

TirushV commented 3 months ago

Hello @ansgarm , We are using terraform cdk to provision our monitoring setup. Appreciate the help here if there is any ETA or any suggestion regarding the above bug. Looking forward for the response. Thank you.

ansgarm commented 3 months ago

Hi @TirushV 👋

I seem to have found a fix (#3580) that will resolve this. In the meantime you could also use a manual override to set that property.

ansgarm commented 3 months ago

Closed via #3580

github-actions[bot] commented 2 months ago

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.