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

ID value for resource 'ciscoise_trusted_certificate_import' does not match the ID value from the OpenAPI #58

Closed aussietexan closed 1 year ago

aussietexan commented 1 year ago

Environment:

ISE version and patch: ISE 3.1 patch 3
Terraform version: 1.2.3
ISE provider version: 0.6.8-beta
OS version: MacOS 12.6

Describe the bug Using the resource 'ciscoise_trusted_certificate_import' with the required parameters works as expected to imported a CA certificate into the ISE Trusted Certificates store. However, the {id} value returned and tracked by terraform state does not reflect the ID value returned by a GET request from the API.

Expected behavior The {id} value tracked by TF state should be equal to the ID generated by the object creation in ISE. This needs to be the same as the ID used by the API so that any subsequent operations are executed on the correct object in ISE.

For example, the value of 'ciscoise_trusted_certificate_import.example.id' should be equal to the "id" value from the API.

Example output from TF apply Plan: 1 to add, 0 to change, 0 to destroy. ciscoise_trusted_certificate_import.root-ca-ise31-2: Creating... ciscoise_trusted_certificate_import.root-ca-ise31-2: Creation complete after 2s [id=1665444832]

ID from API GET request '/api/v1/certs/trusted-certificate' (snipped) { "id": "13cafff4-8acf-46a0-af0d-465015ee5b79"

fmunozmiranda commented 1 year ago

Hey @aussietexan , you can access to id returned by API if you do it like this: ciscoise_trusted_certificate_import.example.item.0.id

You can see all item struct on tfstate file

aussietexan commented 1 year ago

Thanks @fmunozmiranda. I confirmed that the 'item.0.id' does match the 'id' value from the API. Please feel free to close this issue.

fmunozmiranda commented 1 year ago

Happy to help.