cisco-en-programmability / terraform-provider-dnacenter

https://registry.terraform.io/providers/cisco-en-programmability/dnacenter/latest/docs
MIT License
14 stars 12 forks source link

dnacenter_sda_fabric_authentication_profile failure on state refresh #106

Closed mschedrin closed 1 year ago

mschedrin commented 1 year ago

Prerequisites

Describe the bug When terraform refreshes state during terraform plan or apply, resource dnacenter_sda_fabric_authentication_profile throws an error. Here is cropped output:

dnacenter_sda_fabric_authentication_profile.Fabric_Auth["sda_auth1"]: Refreshing state... [id=authenticate_template_name:=Closed Authentication\site_name_hierarchy:=Global/Norway/NW01]
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the
│ changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors
│ or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Failure when executing GetDefaultAuthenticationProfileFromSdaFabric
│
│   with dnacenter_sda_fabric_authentication_profile.Fabric_Auth["Global/Norway/NW02"],
│   on sda_site.tf line 15, in resource "dnacenter_sda_fabric_authentication_profile" "Fabric_Auth":
│   15: resource "dnacenter_sda_fabric_authentication_profile" "Fabric_Auth" {
│
│ error with operation GetDefaultAuthenticationProfileFromSdaFabric
╵
╷
│ Error: Failure when executing GetDefaultAuthenticationProfileFromSdaFabric
│
│   with dnacenter_sda_fabric_authentication_profile.Fabric_Auth["Global/Norway/NW01"],
│   on sda_site.tf line 15, in resource "dnacenter_sda_fabric_authentication_profile" "Fabric_Auth":
│   15: resource "dnacenter_sda_fabric_authentication_profile" "Fabric_Auth" {
│
│ error with operation GetDefaultAuthenticationProfileFromSdaFabric
╵

Here is terraform debug log: tf.txt

Expected behavior No error is expected to be thrown.

Screenshots

image

Environment (please complete the following information):

fmunozmiranda commented 1 year ago

Hey @mschedrin, could you please pass me your tf_file? I test it and I don't get that error.

mschedrin commented 1 year ago

To reproduce the issue you need specific configuration on DNAC so that it replies following on request GET /dna/intent/api/v1/business/sda/authentication-profile?authenticateTemplateName=Closed+Authentication&siteNameHierarchy=Global%2FNorway%2FNW02 HTTP/1.1:

{
   "status": "failed",
   "description": "Could not find fabric site for given siteNameHierarchy in request.",
   "executionId": "4ec60ae7-77e2-4348-adb4-9fffdaaf45b9"
}

Take look on lines 1874 - 1914 in terraform debug log attached to the issue. Reply from DNAC should be handled correctly and resource must be updated.

fmunozmiranda commented 1 year ago

Could you please, pass that part of your tf_file, or could you explain to me what you are trying to do? Are you trying to change the siteNameHierchachy on an already executed resource? @mschedrin

mschedrin commented 1 year ago

I cannot reproduce this issue any more, sorry.