orcasecurity / terraform-provider-orcasecurity

Orca Security Terraform Provider
https://registry.terraform.io/providers/orcasecurity/orcasecurity/latest/docs
Mozilla Public License 2.0
4 stars 2 forks source link

Orca Provider Crashing For orcasecurity_business_unit #102

Open markekibbe opened 2 weeks ago

markekibbe commented 2 weeks ago

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. 1.5.5 -> Unable to upgrade due to BUSL

Affected Resource(s)

Terraform Configuration Files

provider "orcasecurity" {
  api_endpoint = "https://app.us.orcasecurity-gov.io/api"
  # ORCASECURITY_API_ENDPOINT
  # ORCASECURITY_API_TOKEN
}

resource "orcasecurity_business_unit" "business_unit_for_aws" {
  name = "test"
  global_filter = false

  # redacted aws cloud account ID number
  # filter_data = {
  #   cloud_vendor_id = [
  #     "1234"
  #   ]
  # }

  # lifecycle {
  #   ignore_changes = [
  #     filter_data,
  #     shiftleft_filter_data
  #   ]
  # }
}

Panic Output

╷ │ Error: Request cancelled │ │ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled. ╵

Stack trace from the terraform-provider-orcasecurity_v0.0.11 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x375ab0]

goroutine 62 [running]:
terraform-provider-orcasecurity/orcasecurity/business_unit.(*businessUnitResource).Create(0x4000206040, {0x8eb3a8, 0x40001b6f60}, {{{{0x8eeab0, 0x4000490390}, {0x6d01e0, 0x40001b7b60}}, {0x8f01f8, 0x40004a0190}}, {{{0x8eeab0, ...}, ...}, ...}, ...}, ...)
        terraform-provider-orcasecurity/orcasecurity/business_unit/resource.go:213 +0x1e0
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x4000121760, {0x8eb3a8, 0x40001b6f60}, 0x40001f7320, 0x40001f72c0)
        github.com/hashicorp/terraform-plugin-framework@v1.3.4/internal/fwserver/server_createresource.go:101 +0x410
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x8eb3a8?, {0x8eb3a8, 0x40001b6f60}, 0x40004a0460, 0x40001f7490)
        github.com/hashicorp/terraform-plugin-framework@v1.3.4/internal/fwserver/server_applyresourcechange.go:57 +0x39c
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x4000121760, {0x8eb3a8?, 0x40001b6e10?}, 0x40004a0410)
        github.com/hashicorp/terraform-plugin-framework@v1.3.4/internal/proto6server/server_applyresourcechange.go:55 +0x1a8
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x400036e140, {0x8eb3a8?, 0x40000b3320?}, 0x4000244070)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/tf6server/server.go:819 +0x3c4
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x787c00?, 0x400036e140}, {0x8eb3a8, 0x40000b3320}, 0x4000244000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x40002b23c0, {0x8eec10, 0x400020c340}, 0x40004f2000, 0x4000386900, 0xd90720, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1335 +0xc68
google.golang.org/grpc.(*Server).handleStream(0x40002b23c0, {0x8eec10, 0x400020c340}, 0x40004f2000, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1712 +0x854
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.56.3/server.go:947 +0xb4
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.56.3/server.go:958 +0x184

Error: The terraform-provider-orcasecurity_v0.0.11 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

An OU created

Actual Behavior

Crash

Steps to Reproduce

  1. terraform apply

Important Factoids

I have attempted to use the resource with various portions populated, but am not proving successful. Also this is a FedRAMP instance.

patrickb-orca commented 2 weeks ago

Hi Mark, I'm still looking into this. Please expect a reply early next week.

markekibbe commented 1 week ago

Patrick,

Alright. Thank You!

Highly appreciate your diligence!

Thanks,

Mark Kibbe

patrickb-orca commented 1 week ago

Sounds great. I was able to replicate the issue in my US instance of Orca. I'm also getting that error "nil pointer dereference". After some initial development, I fixed the error, but I'd like a few more man-hours to solve this across more cases. Please allow me a day or 2 more to fix this, merge a PR, and publish the new provider. Thank you for your patience and for reporting this!

markekibbe commented 1 week ago

Sounds great. I was able to replicate the issue in my US instance of Orca. I'm also getting that error "nil pointer dereference". After some initial development, I fixed the error, but I'd like a few more man-hours to solve this across more cases. Please allow me a day or 2 more to fix this, merge a PR, and publish the new provider. Thank you for your patience and for reporting this!

Patrick,

I've replied internally via the Orca case management system, but this is excellent news. Thank you for the rapid iteration here.

Are you able to access your internal case management system? If so, I'd like to get your thoughts there as I provided a few additional details that cannot be publicly disclosed.

patrickb-orca commented 1 week ago

Fixed here: https://github.com/orcasecurity/terraform-provider-orcasecurity/pull/107

Please allow us a couple days to publish the change to our Terraform provider.

patrickb-orca commented 1 week ago

@markekibbe please pull the provider version v0.0.13. Once you've validated it works for you, I'll close this issue. Thank you!