CiscoISE / terraform-provider-ciscoise

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

Resource 'ciscoise_network_access_conditions' does not support children blocks #91

Closed KubaMazurkiewicz closed 1 year ago

KubaMazurkiewicz commented 1 year ago

Prerequisites

Describe the bug I cannot create network_access_condition with children conditions.

I want to create following condition:

{
    "conditionType": "LibraryConditionAndBlock",
    "isNegate": false,
    "children": [
      {
        "link": null,
        "conditionType": "ConditionAttributes",
        "isNegate": false,
        "dictionaryName": "DEVICE",
        "attributeName": "Location",
        "operator": "equals",
        "dictionaryValue": null,
        "attributeValue": "All Locations"
      },
      {
        "link": null,
        "conditionType": "ConditionAttributes",
        "isNegate": false,
        "dictionaryName": "DEVICE",
        "attributeName": "Device Type",
        "operator": "equals",
        "dictionaryValue": null,
        "attributeValue": "All Device Types"
      }
    ],
    "name": "condition_11",
    "description": null
}

In API directly it works with following curl command:

curl -X POST "https://10.48.35.230:443/api/v1/policy/network-access/condition" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"conditionType\":\"LibraryConditionAndBlock\",\"isNegate\":false,\"children\":[{\"link\":null,\"conditionType\":\"ConditionAttributes\",\"isNegate\":false,\"dictionaryName\":\"DEVICE\",\"attributeName\":\"Location\",\"operator\":\"equals\",\"dictionaryValue\":null,\"attributeValue\":\"All Locations\"},{\"link\":null,\"conditionType\":\"ConditionAttributes\",\"isNegate\":false,\"dictionaryName\":\"DEVICE\",\"attributeName\":\"Device Type\",\"operator\":\"equals\",\"dictionaryValue\":null,\"attributeValue\":\"All Device Types\"}],\"name\":\"condition_11\",\"description\":null}"

I'm getting 201 response.

But when I try to do the same with TF im receiving errors for multiple unsupported arguments:

TF CODE

resource "ciscoise_network_access_conditions" "conditions" {
  provider = ciscoise

  parameters {
    name            = "condtion_11"
    condition_type  = "LibraryConditionAndBlock"
    is_negate       = false

    children {
          condition_type = "ConditionAttributes"
          is_negate =  false
          dictionary_name =  "DEVICE"
          attribute_name = "Location"
          operator = "equals"
          dictionary_value =  null
          attribute_value = "All Locations"
    }
    children {
          condition_type = "ConditionAttributes"
          is_negate =  false
          dictionary_name =  "DEVICE"
          attribute_name = "Device Type"
          operator = "equals"
          dictionary_value =  null
          attribute_value = "All Device Types"
    }

  }
}
terraform plan
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 12, in resource "ciscoise_network_access_conditions" "conditions":
│   12:           dictionary_name =  "DEVICE"
│ 
│ An argument named "dictionary_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 13, in resource "ciscoise_network_access_conditions" "conditions":
│   13:           attribute_name = "Location"
│ 
│ An argument named "attribute_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 14, in resource "ciscoise_network_access_conditions" "conditions":
│   14:           operator = "equals"
│ 
│ An argument named "operator" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 15, in resource "ciscoise_network_access_conditions" "conditions":
│   15:           dictionary_value =  null
│ 
│ An argument named "dictionary_value" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 16, in resource "ciscoise_network_access_conditions" "conditions":
│   16:           attribute_value = "All Locations"
│ 
│ An argument named "attribute_value" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 21, in resource "ciscoise_network_access_conditions" "conditions":
│   21:           dictionary_name =  "DEVICE"
│ 
│ An argument named "dictionary_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 22, in resource "ciscoise_network_access_conditions" "conditions":
│   22:           attribute_name = "Device Type"
│ 
│ An argument named "attribute_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 23, in resource "ciscoise_network_access_conditions" "conditions":
│   23:           operator = "equals"
│ 
│ An argument named "operator" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 24, in resource "ciscoise_network_access_conditions" "conditions":
│   24:           dictionary_value =  null
│ 
│ An argument named "dictionary_value" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 25, in resource "ciscoise_network_access_conditions" "conditions":
│   25:           attribute_value = "All Device Types"
│ 
│ An argument named "attribute_value" is not expected here.

This issue is simiar to: issue 68

Environment (please complete the following information):

fmunozmiranda commented 1 year ago

Hey @KubaMazurkiewicz , plese try it again with new provider version and let us know if it works for you now.

KubaMazurkiewicz commented 1 year ago

works fine. Thanks im closing issue.

terraform apply

Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # ciscoise_network_access_conditions.conditions will be created
  + resource "ciscoise_network_access_conditions" "conditions" {
      + id           = (known after apply)
      + item         = (known after apply)
      + last_updated = (known after apply)

      + parameters {
          + attribute_name      = (known after apply)
          + attribute_value     = (known after apply)
          + condition_type      = "LibraryConditionAndBlock"
          + description         = (known after apply)
          + dictionary_name     = (known after apply)
          + dictionary_value    = (known after apply)
          + id                  = (known after apply)
          + is_negate           = "false"
          + link                = (known after apply)
          + name                = "condtion_11"
          + operator            = (known after apply)
          + week_days           = (known after apply)
          + week_days_exception = (known after apply)

          + children {
              + attribute_name   = "Location"
              + attribute_value  = "All Locations"
              + condition_type   = "ConditionAttributes"
              + description      = (known after apply)
              + dictionary_name  = "DEVICE"
              + dictionary_value = (known after apply)
              + id               = (known after apply)
              + is_negate        = "false"
              + link             = (known after apply)
              + name             = (known after apply)
              + operator         = "equals"
            }
          + children {
              + attribute_name   = "Device Type"
              + attribute_value  = "All Device Types"
              + condition_type   = "ConditionAttributes"
              + description      = (known after apply)
              + dictionary_name  = "DEVICE"
              + dictionary_value = (known after apply)
              + id               = (known after apply)
              + is_negate        = "false"
              + link             = (known after apply)
              + name             = (known after apply)
              + operator         = "equals"
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ciscoise_network_access_conditions.conditions: Creating...
ciscoise_network_access_conditions.conditions: Creation complete after 0s [id=id:=77b1a015-31c8-4a58-bddd-5ea1e44e1d23\name:=condtion_11]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.