CiscoISE / terraform-provider-ciscoise

Terraform Provider for Cisco ISE
https://registry.terraform.io/providers/CiscoISE/ciscoise/latest/docs
MIT License
10 stars 4 forks source link

ciscoise_tacacs_command_sets fail with command arguments as empty string #30

Closed chetanph closed 2 years ago

chetanph commented 2 years ago

Prerequisites

Describe the bug TACACS commands sets API request allows arguments attribute to be an empty string inside commands -> commandList -> command. But the the provider fails with below error when arguments = "" is used.

resource "ciscoise_tacacs_command_sets" "asa_read_only" {
  parameters {
    description      = "ASA Read Only"
    name             = "ASA Operator"
    permit_unmatched = "false"
    commands {
      command_list {
        grant     = "PERMIT"
        command   = "show"
        arguments = ""
      }
    }
  }
}
│ Error: Failure when executing CreateTacacsCommandSets
│ 
│   with ciscoise_tacacs_command_sets.asa_read_only,
│   on policy_elements_conditions.tf line 9, in resource "ciscoise_tacacs_command_sets" "asa_read_only":
│    9: resource "ciscoise_tacacs_command_sets" "asa_read_only" {
│ 
│ error with operation CreateTacacsCommandSets
│ {
│   "ERSResponse" : {
│     "operation" : "POST-create-tacacscommandsets",
│     "messages" : [ {
│       "title" : "Validation Error - Mandatory fields missing: [Arguments]",
│       "type" : "ERROR",
│       "code" : "Application resource validation exception"
│     } ],
│     "link" : {
│       "rel" : "related",
│       "href" : "https://mapper.cisco.com:9060/ers/config/tacacscommandsets",
│       "type" : "application/xml"
│     }
│   }
│ }

Actual API request sent by the provider: arguments field is missing.

POST /ers/config/tacacscommandsets HTTP/1.1
Host: mapper.cisco.com:9060
Cookie: APPSESSIONID=484DD05EA75430A41FD9399997A89583; JSESSIONIDSSO=51E335C6DB3D45B9940DD582FB700A64
Content-Type: application/json
Accept: application/json
User-Agent: go-resty/2.7.0 (https://github.com/go-resty/resty)
Authorization: Basic bWFwcGVyYXBpOlNvYXIuMTIzIQ==
Content-Length: 164
Accept-Encoding: gzip, deflate
Connection: close

{"TacacsCommandSets":{"name":"ASA Operator","description":"ASA Read Only","permitUnmatched":false,"commands":{"commandList":[{"grant":"PERMIT","command":"show"}]}}}

Expected behavior Provider should include arguments field in the API call even when it is an empty string as it is required by the API.

Screenshots Successful API call: Screen Shot 2022-05-10 at 3 20 46 PM

Environment:

terraform -version
Terraform v1.0.1
on darwin_amd64
+ provider registry.terraform.io/ciscoise/ciscoise v0.5.0-beta

Your version of Terraform is out of date! The latest version
is 1.1.9. You can update by downloading from https://www.terraform.io/downloads.html

Additional context N/A

bvargasre commented 2 years ago

Hi @chetanph, we are working on it.

bvargasre commented 2 years ago

Hi @chetanph new versions of ciscoise-go-sdk v1.1.4 and terraform-provider-ciscoise v0.6.0-beta has been released, try with these new versions and let us know if it work for you.

chetanph commented 2 years ago

Yes, it works with newer version. Thank you!!