oracle / terraform-provider-oci

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

panic: runtime error: invalid memory address or nil pointer dereference #2220

Open mgomez-oracle opened 1 day ago

mgomez-oracle commented 1 day ago

oci_database_db_home provisioning crashes when trying to apply for second time. Seems like first time provisioning works fine, but when we try to change a db_home attribute, the plan phase crashes with the memory address error.

Community Note

Terraform Version and Provider Version

Terraform 1.9.6

required_providers { oci = { source = "oracle/oci" version = "6.12.0" } vault = { source = "hashicorp/vault" version = "4.4.0" } } }

Affected Resource(s)

affected_resources = oci_database_db_home

Terraform Configuration Files


resource "oci_database_db_home" "db_home" {
    db_version      = "19.24.0.0.0"
    display_name    = "dbhome-test"
    source          = "VM_CLUSTER_NEW"
    vm_cluster_id   = ******
    defined_tags    = ******
}```

### Debug Output

terraform apply -input=false -auto-approve tfplan
module.db_exadata.oci_database_db_home.db_home: Modifying... [id=ocid1.dbhome.oc1.*****]
β•·
β”‚ Error: Plugin did not respond
β”‚
β”‚ with module.db_exadata.oci_database_db_home.db_home,
β”‚ on .terraform/modules/db_exadata/dbhome.tf line 24, in resource "oci_database_db_home" "db_home":
β”‚ 24: resource "oci_database_db_home" "db_home" {
β”‚
β”‚ The plugin encountered an error, and failed to respond to the
β”‚ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
β”‚ contain more details.
β•΅
Stack trace from the terraform-provider-oci_v6.13.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4dbbd0a]
goroutine 26 [running]:
github.com/oracle/terraform-provider-oci/internal/service/database.(*DatabaseDbHomeResourceCrud).Update(0xc003e3a9c0)
github.com/oracle/terraform-provider-oci/internal/service/database/database_db_home_resource.go:605 +0x30a
github.com/oracle/terraform-provider-oci/internal/tfresource.UpdateResource({0x87ac0f0, 0xc003dd0800}, {0x873a018, 0xc003e3a9c0})
github.com/oracle/terraform-provider-oci/internal/tfresource/crud_helpers.go:359 +0x134
github.com/oracle/terraform-provider-oci/internal/service/database.updateDatabaseDbHome(0xc003dd0800, {0x7dfd600, 0xc002b9cd98})
github.com/oracle/terraform-provider-oci/internal/service/database/database_db_home_resource.go:1560 +0x10c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x879da28?, {0x879da28?, 0xc003dc2c00?}, 0xd?, {0x7dfd600?, 0xc002b9cd98?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:800 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0026[142](https://gitlab.falabella.tech/fif/core/infraestructura/oci/databaseoracleexadata/bfa-cl-flx-exa-sascl1-prd-00/-/jobs/36635627#L142)a0, {0x879da28, 0xc003dc2c00}, 0xc003de05b0, 0xc003dd0600, {0x7dfd600, 0xc002b9cd98})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:919 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc002b9c678, {0x879da28?, 0xc003dc2b40?}, 0xc003dc0460)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xd5c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000142aa0, {0x879da28?, 0xc003dc2180?}, 0xc0002c33b0)
github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/tf5server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x7a91d00, 0xc000142aa0}, {0x879da28, 0xc003dc2180}, 0xc002c39b80, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000228e00, {0x879da28, 0xc003dc20f0}, {0x87b2600, 0xc002cc0000}, 0xc003da9e60, 0xc002bba7e0, 0xcadaff8, 0x0)
google.golang.org/grpc@v1.61.1/server.go:1385 +0xdd1
google.golang.org/grpc.(*Server).handleStream(0xc000228e00, {0x87b2600, 0xc002cc0000}, 0xc003da9e60)
google.golang.org/grpc@v1.61.1/server.go:1796 +0xfb8
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.61.1/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
google.golang.org/grpc@v1.61.1/server.go:1040 +0x125
Error: The terraform-provider-oci_v6.13.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: command terminated with exit code 1

### Panic Output

Stack trace from the terraform-provider-oci_v6.13.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4dbbd0a]

### Expected Behavior

provisioning with no errors

### Actual Behavior

Panic error

### Steps to Reproduce

1. `terraform apply`

### Important Factoids

First execution works fine. We change a resource attribute (a defined tag), and then when we try to update the resource instance, we run into the described error.

### References

None
tf-oci-pub commented 1 day ago

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

mgomez-oracle commented 3 hours ago

@tf-oci-pub any way to track that internal ticket, or maybe knowing which provider version is stable for ExaCS 19c?

Thanks