Skip to content

Commit

Permalink
Provider does not detect changes in resource dnacenter_configuration_…
Browse files Browse the repository at this point in the history
…template made outside of terraform

#211 UPDATING params
  • Loading branch information
fmunoz committed Sep 27, 2023
1 parent 998b327 commit 2aa7d3a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions dnacenter/resource_configuration_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -1962,13 +1962,6 @@ func resourceConfigurationTemplate() *schema.Resource {
Optional: true,
Computed: true,
},
"template_id": &schema.Schema{
Description: `templateId path parameter. templateId(UUID) of template to be deleted
`,
Type: schema.TypeString,
Optional: true,
Default: "",
},
"template_params": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -2267,16 +2260,18 @@ func resourceConfigurationTemplateCreate(ctx context.Context, d *schema.Resource
} else {
queryParamImport := dnacentersdkgo.GetsAListOfProjectsQueryParams{}
queryParamImport.Name = vvProjectName

log.Print("[DEBUG] 1")
response2, err := searchConfigurationTemplatesGetsTheTemplatesAvailable(m, queryParamImport, vvName)
// log.Printf("[DEBUG] response2 sent => %v", responseInterfaceToString(*response2))
log.Printf("[DEBUG] response2 sent => %v", responseInterfaceToString(*response2))
if response2 != nil && err == nil {
log.Print("[DEBUG] 2")
resourceMap := make(map[string]string)
resourceMap["template_name"] = response2.Name
resourceMap["project_name"] = response2.ProjectName
resourceMap["template_id"] = response2.ID
resourceMap["project_id"] = response2.ProjectID
d.SetId(joinResourceID(resourceMap))
log.Print("[DEBUG] 3")
return resourceConfigurationTemplateRead(ctx, d, m)
}
}
Expand Down Expand Up @@ -2374,6 +2369,12 @@ func resourceConfigurationTemplateRead(ctx context.Context, d *schema.ResourceDa
err))
return diags
}
if err := d.Set("parameters", vItem1); err != nil {
diags = append(diags, diagError(
"Failure when setting GetsTheTemplatesAvailable search response",
err))
return diags
}

}
return diags
Expand Down Expand Up @@ -4427,12 +4428,17 @@ func searchConfigurationTemplatesGetsTheTemplatesAvailable(m interface{}, queryP
client := m.(*dnacentersdkgo.Client)
var err error
var foundItem *dnacentersdkgo.ResponseItemConfigurationTemplatesGetsAListOfProjectsTemplates
log.Print("[DEBUG] 4")
nResponse, _, err := client.ConfigurationTemplates.GetsAListOfProjects(&queryParams)

log.Print("[DEBUG] 5")
if err != nil {
log.Printf("[DEBUG] Error when search => %s", err.Error())
return foundItem, err
}
if nResponse == nil {
log.Printf("[DEBUG] Error when search => %s", err.Error())
return foundItem, err
}
//maxPageSize := 10
log.Printf("[DEBUG] Start to find a concidence")
for _, item := range *nResponse {
Expand Down

0 comments on commit 2aa7d3a

Please sign in to comment.