Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While creating nsxt_policy_lb_virtual_server along with dynamic rule set, getting error. #1455

Open
ravishankar1jan opened this issue Oct 29, 2024 · 4 comments · May be fixed by #1463
Open
Assignees
Labels
bug Bug

Comments

@ravishankar1jan
Copy link

Describe the bug

Hello Team,
I have tried to create virtual server with rule set using terraform with nsxt provider version 3.6.2 as well as 3.7.0
However, when i am trying to create with rules it's throwing following error:


│ Error: Plugin did not respond

│ with module.my_module_name.nsxt_policy_lb_virtual_server.test,
│ on .terraform/modules/my_module_name/virtual-server.tf line 12, in resource "nsxt_policy_lb_virtual_server" "test":
│ 12: resource "nsxt_policy_lb_virtual_server" "test" {

│ 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-nsxt_v3.7.0 plugin:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 76 [running]:
github.com/vmware/terraform-provider-nsxt/nsxt.getPolicyLbRulesFromSchema(0xc000778600?)
github.com/vmware/terraform-provider-nsxt/nsxt/resource_nsxt_policy_lb_virtual_server.go:1416 +0x4997
github.com/vmware/terraform-provider-nsxt/nsxt.resourceNsxtPolicyLBVirtualServerCreate(0xc000778600, {0x1bf5480, 0xc0003f9380})
github.com/vmware/terraform-provider-nsxt/nsxt/resource_nsxt_policy_lb_virtual_server.go:1619 +0x605
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1f4a590?, {0x1f4a590?, 0xc000a8f260?}, 0xd?, {0x1bf5480?, 0xc0003f9380?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:766 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0000195e0, {0x1f4a590, 0xc000a8f260}, 0xc0004bea90, 0xc000778480, {0x1bf5480, 0xc0003f9380})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000481d40, {0x1f4a590?, 0xc000a8f1a0?}, 0xc000a0bcc0)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1060 +0xd5c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00035cdc0, {0x1f4a590?, 0xc000a8e9c0?}, 0xc0002de380)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x56f
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1c18120, 0xc00035cdc0}, {0x1f4a590, 0xc000a8e9c0}, 0xc0002de310, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001d0000, {0x1f4f580, 0xc0004bc000}, 0xc000a918c0, 0xc0002f60c0, 0x28888d8, 0x0)
google.golang.org/[email protected]/server.go:1358 +0xde3
google.golang.org/grpc.(*Server).handleStream(0xc0001d0000, {0x1f4f580, 0xc0004bc000}, 0xc000a918c0, 0x0)
google.golang.org/[email protected]/server.go:1735 +0x9da
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/[email protected]/server.go:970 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 20
google.golang.org/[email protected]/server.go:981 +0x136
Error: The terraform-provider-nsxt_v3.7.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.

Please let me know if you need any additional details.

Regards,
Ravi Shankar

Reproduction steps

  1. Tried with nsxt provider version 3.6.2 and getting similar error
  2. Tried with nsxt provider version 3.7.0 and getting similar error

...

Expected behavior

Multiple rules set should be created using dynamic block with nsxt_policy_lb_virtual_server resource.

Additional context

Please let me know if you need any additional information to check/investigate issue.
image
image

@ravishankar1jan ravishankar1jan added the bug Bug label Oct 29, 2024
@ksamoray
Copy link
Collaborator

Hi @ravishankar1jan, can you please include the nsxt_policy_lb_virtual_server resource which triggered the failure?

@ravishankar1jan
Copy link
Author

Hi @ravishankar1jan, can you please include the nsxt_policy_lb_virtual_server resource which triggered the failure?

Thanks for looking into this. Following code i am using to create virtual server resource along with rule set

resource "nsxt_policy_lb_virtual_server" "test" {
display_name = var.vs_display_name
description = var.vs_description
access_log_enabled = var.vs_access_log_enabled
enabled = var.vs_access_log_enabled
ip_address = var.vs_ip_address
ports = [var.vs_ports]
default_pool_member_ports = [var.vs_default_pool_member_ports]
service_path = var.vs_service_path
max_concurrent_connections = var.vs_max_concurrent_connections
max_new_connection_rate = var.vs_max_new_connection_rate
application_profile_path = nsxt_policy_lb_http_application_profile.test.path
pool_path = "/infra/lb-pools/${nsxt_policy_lb_pool.test.id}"

dynamic "client_ssl" {
for_each = var.vs_ports == 443 ? [1] : []
content {
client_auth = "IGNORE"
default_certificate_path = data.nsxt_policy_certificate.cert1.path
certificate_chain_depth = 3
ssl_profile_path = nsxt_policy_lb_client_ssl_profile.test.path
sni_paths = [data.nsxt_policy_certificate.sni_cert.path]
}
}

dynamic "rule" {
for_each = var.rules
content {
display_name = rule.value.display_name
match_strategy = rule.value.match_strategy
phase = rule.value.phase

  dynamic "action" {
    for_each = rule.value.actions
    content {
      http_request_header_delete {
        header_name = action.value.header_name
      }
    }
  }

  dynamic "condition" {
    for_each = rule.value.conditions
    content {
      http_request_body {
        body_value = condition.value.body_value
        match_type = condition.value.match_type
      }
    }
  }
}

}
}

@ksamoray
Copy link
Collaborator

@ravishankar1jan I suspect that this is due to an empty action block under the rule, but I should verify this.

@ravishankar1jan
Copy link
Author

@ravishankar1jan I suspect that this is due to an empty action block under the rule, but I should verify this.

Thanks for looking into it. I have also added the action block, however getting similar issue. Please let me know if you need any additional details.

@annakhm annakhm self-assigned this Nov 4, 2024
@annakhm annakhm linked a pull request Nov 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants