ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
182 stars 133 forks source link

[FEATURE] [Logs Data Platform] Setting the retention period of a logs data stream #687

Closed pgillet closed 1 month ago

pgillet commented 1 month ago

Description

It is not possible to set the retention period of a logs data stream within Terraform, among the possible values in the OVHcloud console: 14 days, a month, 3 months or a year.

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

Add a retention_period or similar argument to the resource ovh_dbaas_logs_output_graylog_stream.

Additional context

There is indeed the retention_id argument which allows to set the retention period but there is no Terraform resource/data source mapped to the endpoint /dbaas/logs/{serviceName}/cluster/{clusterId}/retention that would retrieve such an ID.

amstuta commented 1 month ago

@pgillet I just added a datasource that allows you to find a retention either by its ID or by its duration, and a second PR that adds an example in the doc of ovh_dbaas_logs_output_graylog_stream resource to use the new datasource.

pgillet commented 1 month ago

That's purrfect 😸

Always impressed and grateful for OVH's responsiveness. You guyz are the best 👍

When will it be released?

amstuta commented 1 month ago

That's great to hear 😃 we'll try to make a release this afternoon, and if not possible on Monday ;)

amstuta commented 1 month ago

@pgillet version 0.47.0 has been released !

131 commented 1 month ago

I find it difficult to find the cluster_id , i end up using


data "ovh_dbaas_logs_cluster_retention" "retention_3months" {
  service_name = "ldp-ra-XXXX"
  cluster_id   =  substr(data.ovh_dbaas_logs_cluster.logstash.id, -36, 36)
  duration     = "P90D"
}

Is there a better way to access the cluster id ?

amstuta commented 1 month ago

@131 In fact I just noticed that the field cluster_id should be set in the datasource ovh_dbaas_logs_cluster and it is not.

I just made this PR to fix this so you don't need to use substr on the id itself ;)

https://github.com/ovh/terraform-provider-ovh/pull/694

131 commented 1 month ago

Thank you very much, i'll be waiting for the next release train