logdna / terraform-provider-logdna

Terraform provider to simplify creation of views, preset alerts and other resources in LogDNA!
https://registry.terraform.io/providers/logdna/logdna/latest
MIT License
11 stars 12 forks source link

Error - Cannot read the remote archive resource #53

Open kroc353 opened 2 years ago

kroc353 commented 2 years ago

logdna terraform resource logdna_archive creates successfully , and destroys successfully, but if modified outside of terraform, produces error during plan, apply, or destroy.

Terraform Version

Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/logdna/logdna v1.10.0

Expected/Desired Behavior

If the logdna instance's archive configuration is modified outside of terraform, such as a bucket setting was changed OR the archive setting was disabled completely, subsequent terraform plan or apply should identify this change and return the configuration to IaC desired state.

Actual behavior witnessed

Logdna archiving is successfully implemented with the configuration. If not modifications are made outside of terraform, the configuration can be removed with a terraform destroy. But , when testing a real world scenario of configuration change outside of terraform, an error is received during the terraform plan, apply or destroy's state refresh.

Error message

╷
│ Error: Cannot read the remote archive resource
│ 
│   with module.logdna_cos_archive.logdna_archive.config,
│   on modules/logdna/main.tf line 26, in resource "logdna_archive" "config":
│   26: resource "logdna_archive" "config" {
│ 
│ GET https://api.us-east.logging.cloud.ibm.com/v1/config/archiving, status 404 NOT OK! {"error":"No active archiving configuration
│ exists","code":"NotFound","status":"error"}
╵

Terraform module code

terraform {
  required_providers {
    logdna = {
      source  = "logdna/logdna"
      version = ">=1.10.0"
    }
  }
}

provider "logdna" {
  servicekey = var.logdna_servicekey
  url               = var.logdna_url
}

resource "logdna_archive" "config" {
  integration = "ibm"
  ibm_config {
    bucket                      = var.bucket
    endpoint                  = var.endpoint
    apikey                      = var.apikey
    resourceinstanceid = var.resourceinstanceid
  }
}
elisiano commented 2 years ago

I can confirm I see a similar behavior with other resource types (category, alert and view have been observed with this behavior).

In my case the resources were deleted outside of terraform but as mentioned by @kroc353, the provider should reconcile to the desired state instead of erroring out.

gjanco commented 2 years ago

We will look into fixing this. We do not have a precise timeline on when it will be complete.

kroc353 commented 1 year ago

Has there been any progress on this issue?

kroc353 commented 1 year ago

Confirming that the issue still exists at the latest available provider. Thank you.

terraform version
Terraform v1.3.7
on darwin_arm64
+ provider registry.terraform.io/logdna/logdna v1.14.2