ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
35 stars 23 forks source link

Terraform does not realise when logging_pipeline is ready #584

Closed salyh closed 3 months ago

salyh commented 3 months ago

Description

I try to create a logging pipeline via terraform.

resource "ionoscloud_logging_pipeline" "xxx" {
  name = "xxx"
  log {
    source   = "kubernetes"
    tag      = "kubernetes"
    protocol = "tcp"
    destinations {
      type              = "loki"
      retention_in_days = 30
    }
  }
}

After 8 minutes its still creating:

ionoscloud_logging_pipeline.xxx: Still creating... [8m1s elapsed]

but when I query the status via ionosctl the logging pipeline appears ready (see screenshot)

Expected behavior

Terraform realise when logging pipeline is ready and continues to create other resources or exists with status code 0

Environment

Terraform version:

OpenTofu v1.7.2

Provider version:

v6.4.17

OS:

Monosnap ~ 2024-06-19 13-13-38
$ ionosctl logging-service pipeline list
Id                                     Name         GrafanaAddress                                  CreatedDate
8f7xxxxx   XXX   grafana.xxxxxx.logging.xxxxx.ionos.com   2024-06-19T11:06:57Z
salyh commented 3 months ago

Looks like the "state": attribute is missing in the returned json?

According to the API (https://api.ionos.com/docs/logging/v1/#tag/Pipelines/operation/pipelinesFindById) there should be such a state field.

Monosnap IONOS Logging REST API 2024-06-19 13-46-40
salyh commented 3 months ago

Internal ticket ref 207171757

salyh commented 3 months ago
Monosnap meod-control-plane – logging tf  meod-control-plane  2024-06-22 12-59-45
salyh commented 3 months ago

https://github.com/ionos-cloud/sdk-go-logging/blob/4256f7f1ec700e40781f99943f0b3c280293a4fa/model_metadata.go#L31

For me it looks like it should be json:"status,omitempty" instead of json:"state,omitempty" to match "status": "AVAILABLE"

adeatcu-ionos commented 3 months ago

Hello! I will investigate this. Is it a long time between you noticing that the pipeline is AVAILABLE vs Terraform notifying you that the creation was successful? Maybe there is a small difference because of the ways in which the refresh calls are done in this function that basically handles the wait for resource to become "AVAILABLE" logic.

salyh commented 3 months ago

Hello! I will investigate this. Is it a long time between you noticing that the pipeline is AVAILABLE vs Terraform notifying you that the creation was successful?

Terraform never notifies me that the creation was successful!

Maybe there is a small difference because of the ways in which the refresh calls are done in this function that basically handles the wait for resource to become "AVAILABLE" logic.

I think its a bug like descibed here https://github.com/ionos-cloud/sdk-go-logging/issues/3#issue-2367778000

adeatcu-ionos commented 3 months ago

@salyh thank you for the clarification, I will take a look.

cristiGuranIonos commented 3 months ago

Hi, we have an issue opened with the logging team. Will be fixed asap.

cristiGuranIonos commented 3 months ago

Fixed, should work now. It was the state/status field, thanks for the help.