terraform-provider-avi icon indicating copy to clipboard operation
terraform-provider-avi copied to clipboard

Resource avi_server: port is not optional

Open dkeitzel opened this issue 1 year ago • 0 comments

Describe the bug

Creating a resource avi_server while omitting the port results in:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to avi_server.server_example, provider "provider[\"registry.terraform.io/vmware/avi\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

The port should be optional (as stated in the API documentation). Omitting the port is fine as long as there is a default_server_port declared in the avi_pool resource.

Reproduction steps

Minimal TF configuration of the resources:

resource "avi_pool" "pool_example" {
  name = "POOL_example"
  tenant_ref = data.avi_tenant.example.id
  cloud_ref = data.avi_cloud.default.id
  default_server_port = 31400
}

resource "avi_server" "server_example" {
  hostname = "example.org"
  ip = "127.0.0.1"
  pool_ref = avi_pool.pool_example.id
  //port = 31400
}

Step 1: Run terraform apply

Expected behavior

When omitting the port there should be no error and the port of the server should be set to -.

Additional context

  • We use a custom tenant
  • Provider version: 22.1.4
  • NSX version: 22.1.4

dkeitzel avatar Jul 03 '23 11:07 dkeitzel