oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 681 forks source link

Editing custom metrics using the resource oci_apm_config_config gives 404 error #2245

Open ritikMahajanOHAI opened 2 days ago

ritikMahajanOHAI commented 2 days ago

Community Note

Terraform Version and Provider Version

Terraform v1.6.2 on linux_amd64

Affected Resource(s)

Data Source: oci_apm_config_config

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. 
# Please remove any sensitive information from configuration files before sharing them. 

terraform {
  required_providers {
    oci = {
      source  = "oracle/oci"
      version = "~>6.18"
    }
  }
}

resource "oci_apm_config_config" "custom_metrics" {
  for_each       = var.metrics
  apm_domain_id  = var.apm_domain_id
  config_type    = "OPTIONS"
  display_name   = each.key
  group          = "custom-metric"

  options = jsonencode({
    name             = each.key
    spanFilterId     = lookup(each.value, "span_filter_id", null)
    spanFilterText   = lookup(each.value, "span_filter_text", null)
    valueSource      = each.value["value_source"]
    compartment      = var.compartment_id
    anomalyDetection = each.value["anomaly_detection"]
    dimensions       = lookup(each.value, "dimensions", [])
    namespace        = "oracle_apm_custom"
    resourceGroup    = lookup(each.value, "resource_group", null)
    unit             = lookup(each.value, "unit", null)
  })
}

Debug Output

https://gist.github.com/ritikMahajanOHAI/bcbf87c11bf2b4adf0bb86cea5ecc61e

Panic Output

Expected Behavior

The resource should have been updated.

Actual Behavior

Getting 404 error.

Steps to Reproduce

1 - Create a new custom metric using terraform. 2 - Edit the newly created custom metric by updating the tfvars file. 3 - terraform plan creates a valid plan but terraform update gives error.

  1. terraform apply

Important Factoids

References

tf-oci-pub commented 2 days ago

Thank you for reporting the issue. We have raised an internal ticket to track this. Our service engineers will get back to you.

iliassox commented 2 days ago

Hello @ritikMahajanOHAI ! I want to reproduce your issue so that I can hopefully be able to help, what kind of changes did you make in the tfvars file?

ritikMahajanOHAI commented 2 days ago

I had just removed one of the dimension from the created custom_metric.

iliassox commented 1 day ago

There seems to be an issue with how the update works, currently as a workaround you can try to removing and recreating the resource as the create works fine.

ritikMahajanOHAI commented 1 day ago

@iliassox Thanks for checking and acknowledging the issue. Kindly let us know when can we expect update functionality to be fixed for oci_apm_config_config resource as our scenario requires that we are able to update this resource.

iliassox commented 1 day ago

There is no ETA at the moment but I'll update you once we have an idea. πŸ‘