Open
Description
With the v0.50.0
release, when i want to create an org using an isolation segment the provider crashes.
Below is an example of terraform configuration file :
resource "cloudfoundry_isolation_segment" "public" {
name = "public"
}
resource "cloudfoundry_isolation_segment_entitlement" "my-org" {
segment = data.cloudfoundry_isolation_segment.public.id
orgs = [
cloudfoundry_org.my-org.id
]
}
resource "cloudfoundry_org" "my-org" {
name = "my-org"
}
The terrform plan
works but the terraform apply
produces the following error :
│ Error: Plugin did not respond
│
│ with module.multisite.cloudfoundry_isolation_segment_entitlement.my-org,
│ on ../multisite/service-my-org.tf line 1, in resource "cloudfoundry_isolation_segment_entitlement" "my-org":
│ 1: resource "cloudfoundry_isolation_segment_entitlement" "my-org" {
│
│ 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-cloudfoundry plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb4f752]
goroutine 132 [running]:
code.cloudfoundry.org/cli/api/cloudcontroller/ccv3.(*Client).newHTTPRequest(0xc000004f00, {0xc0001e8960, {0x0, 0x0, 0x0}, {0x1025f7a, 0x2d}, {0x0, 0x0}, {0x0, ...}, ...})
/go/pkg/mod/github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20221116160217-adea22bf4b55+incompatible/api/cloudcontroller/ccv3/request.go:45 +0xd2
code.cloudfoundry.org/cli/api/cloudcontroller/ccv3.(*Client).EntitleIsolationSegmentToOrganizations(0xc000004f00, {0xc0001dae40, 0x24}, {0xc00053d050?, 0xc0005f8840?, 0x1842a80?})
/go/pkg/mod/github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20221116160217-adea22bf4b55+incompatible/api/cloudcontroller/ccv3/relationship_list.go:56 +0x1e5
github.com/terraform-providers/terraform-provider-cloudfoundry/cloudfoundry.resourceSegmentEntitlementCreate({0x118ad10?, 0xc00053af30?}, 0x0?, {0xf2e5c0?, 0xc0003aa160})
/workspace/terraform-provider-cloudfoundry/cloudfoundry/resource_cf_isolation_segment.go:140 +0x389
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0004bd180, {0x118ad10, 0xc00053af30}, 0xd?, {0xf2e5c0, 0xc0003aa160})
/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:707 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0004bd180, {0x118ad10, 0xc00053af30}, 0xc00052b040, 0xc000208f80, {0xf2e5c0, 0xc0003aa160})
/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000495518, {0x118ad10?, 0xc00053ae10?}, 0xc0000eaf00)
/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.0/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0003eea00, {0x118ad10?, 0xc000109f80?}, 0xc000344d90)
/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xfb7f40?, 0xc0003eea00}, {0x118ad10, 0xc000109f80}, 0xc000344d20, 0x0)
/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003e23c0, {0x118fb60, 0xc0004ccb60}, 0xc0000f19e0, 0xc0004a32c0, 0x182e8e0, 0x0)
/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1295 +0xb2b
google.golang.org/grpc.(*Server).handleStream(0xc0003e23c0, {0x118fb60, 0xc0004ccb60}, 0xc0000f19e0, 0x0)
/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1636 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:932 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:930 +0x28a
Error: The terraform-provider-cloudfoundry plugin crashed!