aiven / terraform-provider-aiven

Aiven Terraform Provider
https://registry.terraform.io/providers/aiven/aiven/latest/docs
MIT License
122 stars 68 forks source link

feat: Support Datadog user-config for mirrormaker_custom_metrics #1763

Closed jclarysse closed 3 weeks ago

jclarysse commented 3 weeks ago

About this change

Support for new Datadog integration user-config key mirromaker_custom_metrics.

Contributes to resolving

https://aiven.atlassian.net/browse/EC-252

Why this way

The new feature works as kafka_custom_metrics and so the changes were done based on https://github.com/search?q=repo%3Aaiven%2Fterraform-provider-aiven+_custom_metrics&type=code

byashimov commented 3 weeks ago

Hey. The user configuration is delivered automatically when a field appears on the API spec. Please find me in Slack for more details. Thanks.

jclarysse commented 3 weeks ago

Oh ok pardon me, then I guess that it will be automatically added with next release.

jclarysse commented 3 weeks ago

Currently this works

resource "aiven_service_integration" "my_kafka_datadog_integration" {
    project = data.aiven_project.my_project.project
    destination_endpoint_id = data.aiven_service_integration_endpoint.my_datadog.id
    destination_service_name = ""
    source_service_name = data.aiven_kafka.my_kafka.service_name
    integration_type = "datadog"
      datadog_user_config {
        kafka_custom_metrics = ["kafka.log.log_size", "kafka.log.log_end_offset"]
      }
}

But this doesn't

resource "aiven_service_integration" "my_mirromaker_datadog_integration" {
    project = data.aiven_project.my_project.project
    destination_endpoint_id = data.aiven_service_integration_endpoint.my_datadog.id
    destination_service_name = ""
    source_service_name = data.aiven_kafka_mirrormaker.my_mirrormaker.service_name
    integration_type = "datadog"
      datadog_user_config {
        mirrormaker_custom_metrics = ["kafka_mirrormaker_summary.replication_lag"]
      }
}

Error message

│ Error: Unsupported argument
│ 
│   on aiven_service_integration_data_source.tf line 55, in resource "aiven_service_integration" "my_mirromaker_datadog_integration":
│   55:         mirrormaker_custom_metrics = ["kafka_mirrormaker_summary.replication_lag"]
│ 
│ An argument named "mirrormaker_custom_metrics" is not expected here.

I assume that is is already part of the API spec since it works using Aiven CLI, see DOC-1054.

My understanding is that this information is automatically fetched when building the provider.

byashimov commented 2 weeks ago

Hey. It landed yesterday https://github.com/aiven/go-api-schemas/blame/6c861c0f7f05589f5c2313bb9015c76f7116be9b/pkg/dist/integration_types.yml#L288 Will be delivered with the next released. No worries!