Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci_sch_service_connector resource terraform apply adds optional attributes causing failure on next apply #2083

Open
rdesai3 opened this issue Apr 2, 2024 · 2 comments
Labels
bug In-Progress Terraform Team is working on the reproduce & fix

Comments

@rdesai3
Copy link

rdesai3 commented Apr 2, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

Terraform v1.7.5
on darwin_amd64
+ provider registry.terraform.io/oracle/oci v5.35.0

Affected Resource(s)

oci_sch_service_connector

Terraform Configuration Files

resource "oci_sch_service_connector" "test_connector" {
  compartment_id    = "ocid1.compartment.oc1..aaaamycompartment123456789abcdefghijklmnop"
  display_name      = "test-connector"
  description       = "test connector"
  source {
    kind = "logging"
    log_sources {
      compartment_id = "ocid1.compartment.oc1..aaaamycompartment123456789abcdefghijklmnop"
      log_group_id   = "_Audit"
    }
  }
  target {
    kind        = "functions"
    function_id = "ocid1.fnfunc.oc1.region.aaaamyfunction123456789abcdefghijklmnop"
  }
}

Expected Behavior

terraform apply should only add the required attributes to the resource state.

Actual Behavior

After terraform apply of the above code, undefined optional resource attributes like batch_rollover_size_in_mbs, batch_rollover_time_in_ms, batch_size_in_kbs, batch_size_in_num, batch_time_in_sec, etc. get added to the terraform resource state.

# oci_sch_service_connector.test_connector:
resource "oci_sch_service_connector" "test_connector" {
    compartment_id = "ocid1.compartment.oc1..aaaamycompartment123456789abcdefghijklmnop"
    defined_tags   = {
        "Oracle-Tags.CreatedBy" = "default/abc@xyz.com"
        "Oracle-Tags.CreatedOn" = "2024-04-02T17:00:00.000Z"
    }
    description    = "test-connector"
    display_name   = "test-connector"
    freeform_tags  = {}
    id             = "ocid1.serviceconnector.oc1.region.aaaamyconnector123456789abcdefghijklmnop"
    state          = "ACTIVE"
    system_tags    = {}
    time_created   = "2024-04-02T17:00:00.000 +0000 UTC"
    time_updated   = "2024-04-02T17:00:00.000 +0000 UTC"

    source {
        kind = "logging"

        log_sources {
            compartment_id = "ocid1.compartment.oc1..aaaamycompartment123456789abcdefghijklmnop"
            log_group_id   = "_Audit"
        }
    }

    target {
        batch_rollover_size_in_mbs = 0
        batch_rollover_time_in_ms  = 0
        batch_size_in_kbs          = 0
        batch_size_in_num          = 0
        batch_time_in_sec          = 0
        enable_formatted_messaging = false
        function_id                = "ocid1.fnfunc.oc1.region.aaaamyfunction123456789abcdefghijklmnop"
        kind                       = "functions"
    }
}

When trying to terraform apply new changes to the resource, it fails with the following error since batch_size_in_kbs and batch_time_in_sec are set to 0 which were not defined in the initial resource.

╷
│ Error: 400-InvalidParameter, target.batchSizeInNum must be greater than or equal to 1; target.batchSizeInKbs must be greater than or equal to 1; target.batchTimeInSec must be greater than or equal to 60
│ Suggestion: Please update the parameter(s) in the Terraform config as per error message target.batchSizeInNum must be greater than or equal to 1; target.batchSizeInKbs must be greater than or equal to 1; target.batchTimeInSec must be greater than or equal to 60
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/sch_service_connector 
│ API Reference: https://docs.oracle.com/iaas/api/#/en/serviceconnectors/20200909/ServiceConnector/UpdateServiceConnector 
│ Request Target: PUT https://service-connector-hub.us-region-1.oci.oraclecloud.com/20200909/serviceConnectors/ocid1.serviceconnector.oc1.region.aaaamyconnector123456789abcdefghijklmnop 
│ Provider version: 5.35.0, released on 2024-03-27.  
│ Service: Sch Service Connector 
│ Operation Name: UpdateServiceConnector 
│ OPC request ID: SomeValue
│ 
│ 
│   with oci_sch_service_connector.test_connector,
│   on service-connector.tf line 1, in resource "oci_sch_service_connector" "test_connector":
│    1: resource "oci_sch_service_connector" "test_connector" {

Setting the batch parameters would enable batching, however, we do not want batching to be enabled

Steps to Reproduce

  1. terraform apply the above terraform configuration file (update the OCIDs)
  2. make updates to the configuration file. For example, update the description.
  3. terraform apply the updated configuration file.

References

Similar Github issue - #1897

@rdesai3 rdesai3 added the bug label Apr 2, 2024
@tf-oci-pub tf-oci-pub added the In-Progress Terraform Team is working on the reproduce & fix label Apr 3, 2024
@tf-oci-pub
Copy link
Member

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

@sergio-perez-edo
Copy link

Can we know in which version this fix is expected? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug In-Progress Terraform Team is working on the reproduce & fix
Projects
None yet
Development

No branches or pull requests

3 participants