Closed cturner-confluent closed 4 years ago
:tada: Thanks for opening your first issue here! Welcome to the community!
Thanks for reporting this; I saw this and fixed it as part of developing the acceptance tests which are now part of this repo. If you git pull
and rebuild the provider it will now work.
Closing this as it's fixed now.
When attempting to create a new policy resource using the provider Terraform is crashing. It appears it is crashing when it attempts to use the function parsePolicy in the resource_policy.go file at line 351.
Describe the bug
Expected behavior
The expected behavior is that a Prisma Policy is created successfully
Current behavior
Terraform crashes when attempting to create the policy on the parsePolicy function inside of resource_policy.go
Possible solution
Not sure but it appears to be a type mismatch
Steps to reproduce
resource "prismacloud_policy" "example" { name = "My Policy" policy_type = "config" rule { name = "my rule" criteria = "savedSearchId" parameters = { "savedSearch": "true", } rule_type = "Config" } }
Screenshots
Context
This provider is being used to help automate the process of creating new policies and associating them with an alert rule to update what policies we enable auto remediation for.
Your Environment
Crash Output
prismacloud_policy.example: Creating...
Error: rpc error: code = Unavailable desc = transport is closing
panic: interface conversion: interface {} is schema.Set, not []interface {} 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: goroutine 23 [running]: 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.parsePolicy(0xc00022b1f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/src/github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/resource_policy.go:351 +0x1c19 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.createPolicy(0xc00022b1f0, 0x1b2cf60, 0xc00056e9c0, 0x2, 0x255d300) 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/src/github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/resource_policy.go:523 +0x63 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0xc00012eea0, 0xc00021bc20, 0xc0002e27e0, 0x1b2cf60, 0xc00056e9c0, 0x1a8e901, 0xc000577b48, 0xc0009a0b40) 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.9.0/helper/schema/resource.go:310 +0x365 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0xc000046100, 0xc0005fba10, 0xc00021bc20, 0xc0002e27e0, 0xc000998e08, 0xc0000ce880, 0x1a904e0) 2020-06-15T13:17:06.074-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.9.0/helper/schema/provider.go:294 +0x99 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc000010798, 0x1e2bb60, 0xc000930a50, 0xc00022ad20, 0xc000010798, 0xc000930a50, 0xc0005d9b78) 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/helper/plugin/grpc_provider.go:885 +0x8b4 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1b99940, 0xc000010798, 0x1e2bb60, 0xc000930a50, 0xc000201140, 0x0, 0x1e2bb60, 0xc000930a50, 0xc0001d0f00, 0x500) 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x217 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: google.golang.org/grpc.(Server).processUnaryRPC(0xc00019b380, 0x1e35b60, 0xc000802a80, 0xc000190200, 0xc000203380, 0x25235a0, 0x0, 0x0, 0x0) 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1024 +0x501 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: google.golang.org/grpc.(Server).handleStream(0xc00019b380, 0x1e35b60, 0xc000802a80, 0xc000190200, 0x0) 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1313 +0xd3d 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: google.golang.org/grpc.(Server).serveStreams.func1.1(0xc00003c520, 0xc00019b380, 0x1e35b60, 0xc000802a80, 0xc000190200) 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:722 +0xa1 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: created by google.golang.org/grpc.(Server).serveStreams.func1 2020-06-15T13:17:06.075-0600 [DEBUG] plugin.terraform-provider-prismacloud: /Users/cturner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:720 +0xa1 2020/06/15 13:17:06 [DEBUG] prismacloud_policy.example: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing 2020/06/15 13:17:06 [TRACE]: eval: terraform.EvalMaybeTainted
2020/06/15 13:17:06 [TRACE] EvalMaybeTainted: prismacloud_policy.example encountered an error during creation, so it is now marked as tainted
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalWriteState
2020/06/15 13:17:06 [TRACE] EvalWriteState: removing state object for prismacloud_policy.example
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalApplyProvisioners
2020/06/15 13:17:06 [TRACE] EvalApplyProvisioners: prismacloud_policy.example has no state, so skipping provisioners
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalMaybeTainted
2020/06/15 13:17:06 [TRACE] EvalMaybeTainted: prismacloud_policy.example encountered an error during creation, so it is now marked as tainted
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalWriteState
2020/06/15 13:17:06 [TRACE] EvalWriteState: removing state object for prismacloud_policy.example
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalIf
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalIf
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalWriteDiff
2020-06-15T13:17:06.077-0600 [DEBUG] plugin: plugin process exited: path=/Users/cturner/.terraform.d/plugins/terraform-provider-prismacloud pid=17357 error="exit status 2"
2020/06/15 13:17:06 [TRACE] : eval: terraform.EvalApplyPost
2020/06/15 13:17:06 [ERROR] : eval: terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/06/15 13:17:06 [ERROR] : eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/06/15 13:17:06 [TRACE] [walkApply] Exiting eval tree: prismacloud_policy.example
2020/06/15 13:17:06 [TRACE] vertex "prismacloud_policy.example": visit complete
2020/06/15 13:17:06 [TRACE] dag/walk: upstream of "prismacloud_alert_rule.example" errored, so skipping
2020/06/15 13:17:06 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/06/15 13:17:06 [TRACE] dag/walk: upstream of "provider.prismacloud (close)" errored, so skipping
2020/06/15 13:17:06 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/06/15 13:17:06 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2020/06/15 13:17:06 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2020/06/15 13:17:06 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/06/15 13:17:06 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/06/15 13:17:06 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-06-15T13:17:06.087-0600 [DEBUG] plugin: plugin exited
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Terraform crashed! This is always indicative of a bug within Terraform. A crash log has been placed at "crash.log" relative to your current working directory. It would be immensely helpful if you could please report the crash with Terraform1 so that we can fix this.
When reporting bugs, please include your terraform version. That information is available on the first line of crash.log. You can also get it by running 'terraform --version' on the command line.
SECURITY WARNING: the "crash.log" file that was created may contain sensitive information that must be redacted before it is safe to share on the issue tracker.
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!