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

No parent_id parameter available in cisco_endpoint_group resource #95

Closed KubaMazurkiewicz closed 1 year ago

KubaMazurkiewicz commented 1 year ago

Prerequisites

Describe the bug Following TF code is not working:

resource "ciscoise_endpoint_group" "example" {
  provider = ciscoise
  parameters {

    description    = "string"
    name           = "Test05"
    system_defined = "false"
    parent_id = "3b76f840-8c00-11e6-996c-525400b48521"
  }
}

I'm getting error:

➜  bugs_ise git:(endpoint_group) ✗ terraform plan
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 8, in resource "ciscoise_endpoint_group" "example":
│    8:     parent_id = "3b76f840-8c00-11e6-996c-525400b48521"
│ 
│ An argument named "parent_id" is not expected here.

Expected behavior In GUI and in ERS API I can create endpoint identity group with Parent Group:

POST: https://10.48.190.181/ers/config/endpointgroup

Body:

{
    "EndPointGroup": {
        "name": "Test15",
        "description": "string",
        "systemDefined": false,
        "parentId": "3b76f840-8c00-11e6-996c-525400b48521"
    }
}

Result: 201 Created

Environment (please complete the following information):

fmunozmiranda commented 1 year ago

@KubaMazurkiewicz please try it again with 0.6.20-beta and let us know how does it go.

KubaMazurkiewicz commented 1 year ago

Hey @fmunozmiranda with 0.6.20-beta Endpoint Identity Group is being created with parent_id, but state is not handled properly.

First terraform apply command works as expected:

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_endpoint_group.example will be created
  + resource "ciscoise_endpoint_group" "example" {
      + id           = (known after apply)
      + item         = (known after apply)
      + last_updated = (known after apply)

      + parameters {
          + description    = "string"
          + id             = (known after apply)
          + link           = (known after apply)
          + name           = "Test07"
          + parent_id      = "3b76f840-8c00-11e6-996c-525400b48521"
          + system_defined = "false"
        }
    }

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_endpoint_group.example: Creating...
ciscoise_endpoint_group.example: Creation complete after 1s [id=id:=7076dda0-0ee2-11ee-a056-4248683d5372\name:=Test07]

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

but everytime I re-run terraform plan without any modifications to terraform code im getting:

terraform plan
ciscoise_endpoint_group.example: Refreshing state... [id=id:=7076dda0-0ee2-11ee-a056-4248683d5372\name:=Test07]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # ciscoise_endpoint_group.example will be updated in-place
  ~ resource "ciscoise_endpoint_group" "example" {
        id   = "id:=7076dda0-0ee2-11ee-a056-4248683d5372\\name:=Test07"
        # (1 unchanged attribute hidden)

      ~ parameters {
            id             = "7076dda0-0ee2-11ee-a056-4248683d5372"
            name           = "Test07"
          + parent_id      = "3b76f840-8c00-11e6-996c-525400b48521"
            # (3 unchanged attributes hidden)
        }
    }

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

which is not correct behaviour. I should not see any updates in terraform plan command, after i create resource.

fmunozmiranda commented 1 year ago

Hey @KubaMazurkiewicz, could you please share me a screenshoot with the GET endpoint of this resource?

KubaMazurkiewicz commented 1 year ago

GET request: https://10.48.190.181/ers/config/endpointgroup/7076dda0-0ee2-11ee-a056-4248683d5372

Response BODY:

{
    "EndPointGroup": {
        "id": "7076dda0-0ee2-11ee-a056-4248683d5372",
        "name": "Test07",
        "description": "string",
        "systemDefined": false,
        "parentId": "3b76f840-8c00-11e6-996c-525400b48521",
        "link": {
            "rel": "self",
            "href": "https://10.48.190.181/ers/config/endpointgroup/7076dda0-0ee2-11ee-a056-4248683d5372",
            "type": "application/json"
        }
    }
}
fmunozmiranda commented 1 year ago

Hi, @KubaMazurkiewicz please try it again with the new provider version and let me know how does it go.

KubaMazurkiewicz commented 1 year ago

I'ts working fine in v0.6.21-beta. Thanks