oracle / terraform-provider-oci

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

Error: The terraform-provider-oci_v6.14.0 plugin crashed! #2232

Open eist76 opened 2 days ago

eist76 commented 2 days ago

Community Note

Terraform Version and Provider Version

terraform -v Terraform v1.9.8 on linux_amd64

Affected Resource(s)

oci_core_instance

Terraform Configuration Files

main.tf

...
resource "oci_core_instance" "instance" {
  for_each       = local.compute_nodes
  display_name   = each.key
  compartment_id = local.compute_compartment
  availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
  shape               = "VM.PCAStandard1.Flex"
  source_details {
    source_type = "image"
    source_id   = data.oci_core_images.images.images[1].id
  }
  shape_config {
    ocpus         = each.value.cpu
    memory_in_gbs = each.value.memory
  }
  metadata = {
    "ssh_authorized_keys" = "ssh-rsa xxx"
    user_data = base64encode(templatefile("${path.module}/cloud-config.tftpl", {
      mt_exports = local.mt_exports,
      mt_ip      = local.mount_target_ip,
      fs_exports = local.fs_exports,
      hostname   = each.key
    }))
  }
  create_vnic_details {
    private_ip       = each.value.ip
    subnet_id        = split(".", each.value.ip)[3] > 128 ? local.web_subnet : local.app_subnet
    assign_public_ip = false
    hostname_label   = split(".", each.key)[0]
  }
  lifecycle {
    ignore_changes = [metadata, source_details, extended_metadata]
  }
}
...

nodes.tf

locals {
  compute_nodes = {
    "node1.domain.com" : {
      "ip" : "10.10.10.1",
      "cpu" : "2",
      "memory" : "16"
    }
    "node2.domain.com" : {
      "ip" : "10.10.10.2",
      "cpu" : "1",
      "memory" : "8"
    }
...
}

Panic Output

Stack trace from the terraform-provider-oci_v6.14.0 plugin:

panic: interface conversion: interface {} is map[string]interface {}, not map[string]map[string]interface {}

goroutine 229 [running]: github.com/oracle/terraform-provider-oci/internal/service/core.(CoreInstanceResourceCrud).Update(0xc004001ac0) github.com/oracle/terraform-provider-oci/internal/service/core/core_instance_resource.go:1517 +0x2119 github.com/oracle/terraform-provider-oci/internal/tfresource.UpdateResource({0x87ac1d0, 0xc00519e400}, {0x872cc88, 0xc004001ac0}) github.com/oracle/terraform-provider-oci/internal/tfresource/crud_helpers.go:359 +0x134 github.com/oracle/terraform-provider-oci/internal/service/core.updateCoreInstance(0xc00519e400, {0x7dfdb80, 0xc001a98378}) github.com/oracle/terraform-provider-oci/internal/service/core/core_instance_resource.go:1045 +0x2ed github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).update(0x879daf8?, {0x879daf8?, 0xc003d48810?}, 0xd?, {0x7dfdb80?, 0xc001a98378?}) 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(0xc00245ed20, {0x879daf8, 0xc003d48810}, 0xc003d54c30, 0xc003f9ff00, {0x7dfdb80, 0xc001a98378}) 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(0xc002edc5e8, {0x879daf8?, 0xc003d48750?}, 0xc003affb80) 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(0xc000150780, {0x879daf8?, 0xc004d34f90?}, 0xc003abee70) 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({0x7a91d40, 0xc000150780}, {0x879daf8, 0xc004d34f90}, 0xc003f9fb80, 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(0xc00023ae00, {0x879daf8, 0xc004d34f00}, {0x87b26e0, 0xc0017dc820}, 0xc003c779e0, 0xc001f9fb30, 0xcacee18, 0x0) google.golang.org/grpc@v1.61.1/server.go:1385 +0xdd1 google.golang.org/grpc.(Server).handleStream(0xc00023ae00, {0x87b26e0, 0xc0017dc820}, 0xc003c779e0) 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 41 google.golang.org/grpc@v1.61.1/server.go:1040 +0x125

Error: The terraform-provider-oci_v6.14.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.

Expected Behavior

1 new OCI Instance should be deployed/created

Actual Behavior

oci provider crashed

Steps to Reproduce

  1. terraform apply

Important Factoids

i just upgraded the oci provider to version 6.15.0 and this resolves this issue.

References

twmcelroy commented 2 days ago

This seems to be the same as #2219 #2210 #2208 #2205 It has been happening since 6.12.0 and is still not resolved as of 6.15.0. 6.11.0 does seem to work

saltie commented 1 day ago

Not getting much traction on this one. Issue has been there since v6.12.0 and clearly reproducible.