Skip to content

Commit

Permalink
Merge pull request #222 from cisco-en-programmability/develop
Browse files Browse the repository at this point in the history
Develop v1.1.22-beta
  • Loading branch information
fmunozmiranda authored Oct 11, 2023
2 parents 2262fb0 + 3512a2b commit 83362a5
Show file tree
Hide file tree
Showing 197 changed files with 245 additions and 431 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.22-beta (October 10, 2023)
BUGFIXES:
* Provider does not detect changes in resource dnacenter_configuration_template made outside of terraform #211 - possible nil answer exeption managed. Now is possible to test #216.
* Pagination support when interacting with API #215 - removing sleep, code 429 is managed by go-sdk.
## 1.1.21-beta (October 05, 2023)
BUGFIXES:
* userId was added to resourceUserCreate and resourceUserRead to be able to create and read the user (Cannot create user #213).
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HOSTNAME=hashicorp.com
NAMESPACE=edu
NAME=dnacenter
BINARY=terraform-provider-${NAME}
VERSION=1.1.19-beta
VERSION=1.1.20-beta
OS_ARCH=darwin_amd64
# Change to OS_ARCH=darwin_arm64 or your current architecture
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following table shows the supported versions.
| 2.2.3.3 | 0.3.0-beta |
| 2.2.3.3 | 0.3.0 |
| 2.3.3.0 | 1.0.19-beta |
| 2.3.5.3 | 1.1.19-beta |
| 2.3.5.3 | 1.1.20-beta |

If your SDK, Terraform provider is older please consider updating it first.

Expand Down Expand Up @@ -66,7 +66,7 @@ terraform {
required_providers {
dnacenter = {
source = "cisco-en-programmability/dnacenter"
version = "1.1.19-beta"
version = "1.1.20-beta"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dnacenter/resource_application_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func searchApplicationPolicyGetApplicationSets(m interface{}, queryParams dnacen
nResponse, _, err := client.ApplicationPolicy.GetApplicationSets(&queryParams)
maxPageSize := len(*nResponse.Response)
for len(*nResponse.Response) > 0 {
time.Sleep(15 * time.Second)

for _, item := range *nResponse.Response {
if vID == item.ID {
foundItem = &item
Expand Down
2 changes: 1 addition & 1 deletion dnacenter/resource_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ func searchApplicationPolicyGetApplications(m interface{}, queryParams dnacenter
nResponse, _, err := client.ApplicationPolicy.GetApplications(nil)
maxPageSize := len(*nResponse.Response)
for len(*nResponse.Response) > 0 {
time.Sleep(15 * time.Second)

for _, item := range *nResponse.Response {
if vID == item.ID {
foundItem = &item
Expand Down
41 changes: 25 additions & 16 deletions dnacenter/resource_configuration_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,9 +1665,10 @@ func resourceConfigurationTemplate() *schema.Resource {
"last_update_time": &schema.Schema{
Description: `Update time of template
`,
Type: schema.TypeInt,
Optional: true,
Computed: true,
Type: schema.TypeInt,
Optional: true,
Computed: true,
DiffSuppressFunc: diffSuppressAlways(),
},
"latest_version_time": &schema.Schema{
Description: `Latest versioned template time
Expand Down Expand Up @@ -1699,9 +1700,10 @@ func resourceConfigurationTemplate() *schema.Resource {
"project_name": &schema.Schema{
Description: `Project name
`,
Type: schema.TypeString,
Optional: true,
Default: "",
Type: schema.TypeString,
Optional: true,
Default: "",
DiffSuppressFunc: diffSuppressAlways(),
},
"rollback_template_content": &schema.Schema{
Description: `Rollback template content
Expand Down Expand Up @@ -2262,7 +2264,9 @@ func resourceConfigurationTemplateCreate(ctx context.Context, d *schema.Resource
queryParamImport.Name = vvProjectName
log.Print("[DEBUG] 1")
response2, err := searchConfigurationTemplatesGetsTheTemplatesAvailable(m, queryParamImport, vvName)
log.Printf("[DEBUG] response2 sent => %v", responseInterfaceToString(*response2))
if response2 != nil {
log.Printf("[DEBUG] response2 sent => %v", responseInterfaceToString(*response2))
}
if response2 != nil && err == nil {
log.Print("[DEBUG] 2")
resourceMap := make(map[string]string)
Expand Down Expand Up @@ -2334,41 +2338,45 @@ func resourceConfigurationTemplateCreate(ctx context.Context, d *schema.Resource
}

func resourceConfigurationTemplateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
// client := m.(*dnacentersdkgo.Client)
client := m.(*dnacentersdkgo.Client)

var diags diag.Diagnostics

resourceID := d.Id()
resourceMap := separateResourceID(resourceID)
vProjectName := resourceMap["project_name"]
vTemplateName := resourceMap["template_name"]
// vTemplateName := resourceMap["template_name"]
vTemplateID := resourceMap["template_id"]

selectedMethod := 1
if selectedMethod == 1 {
log.Printf("[DEBUG] Selected method: GetsDetailsOfAGivenTemplate")
queryParams1 := dnacentersdkgo.GetsAListOfProjectsQueryParams{}
queryParams1.Name = vProjectName

response1, err := searchConfigurationTemplatesGetsTheTemplatesAvailable(m, queryParams1, vTemplateName)

// response1, err := searchConfigurationTemplatesGetsTheTemplatesAvailable(m, queryParams1, vTemplateName)
response1, restyResp1, err := client.ConfigurationTemplates.GetsDetailsOfAGivenTemplate(vTemplateID, nil)
if err != nil || response1 == nil {
if restyResp1 != nil {
log.Printf("resty response= %s", restyResp1.String())
}
d.SetId("")
return diags
}

log.Printf("[DEBUG] Retrieved response %+v", responseInterfaceToString(*response1))

// Review flatten function used
items := []dnacentersdkgo.ResponseItemConfigurationTemplatesGetsAListOfProjectsTemplates{
*response1,
}
vItem1 := flattenConfigurationTemplatesGetsAListOfProjectsItemsTemplates(&items)
// items := dnacentersdkgo.ResponseConfigurationTemplatesGetsDetailsOfAGivenTemplate{
// *response1,

vItem1 := flattenConfigurationTemplatesGetsDetailsOfAGivenTemplateItem(response1)
if err := d.Set("item", vItem1); err != nil {
diags = append(diags, diagError(
"Failure when setting GetsTheTemplatesAvailable search response",
err))
return diags
}

if err := d.Set("parameters", vItem1); err != nil {
diags = append(diags, diagError(
"Failure when setting GetsTheTemplatesAvailable search response",
Expand Down Expand Up @@ -4444,6 +4452,7 @@ func searchConfigurationTemplatesGetsTheTemplatesAvailable(m interface{}, queryP
for _, item := range *nResponse {
for _, item2 := range *item.Templates {
if vName == item2.Name {
log.Printf("Vname %s , item2.Name %s", vName, item2.Name)
foundItem = &item2
return foundItem, err
}
Expand Down
2 changes: 1 addition & 1 deletion dnacenter/resource_device_replacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func searchDeviceReplacementReturnListOfReplacementDevicesWithReplacementDetails
nResponse, _, err := client.DeviceReplacement.ReturnListOfReplacementDevicesWithReplacementDetails(nil)
maxPageSize := len(*nResponse.Response)
for len(*nResponse.Response) > 0 {
time.Sleep(15 * time.Second)

for _, item := range *nResponse.Response {
if vID == item.FaultyDeviceID {
foundItem = &item
Expand Down
3 changes: 1 addition & 2 deletions dnacenter/resource_event_subscription_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"reflect"
"time"

"log"

Expand Down Expand Up @@ -964,7 +963,7 @@ func searchEventManagementGetEmailEventSubscriptions(m interface{}, queryParams
nResponse, _, err := client.EventManagement.GetEmailEventSubscriptions(nil)
maxPageSize := len(*nResponse)
for len(*nResponse) > 0 {
time.Sleep(15 * time.Second)

for _, item := range *nResponse {
if vID == item.SubscriptionID {
foundItem = &item
Expand Down
2 changes: 0 additions & 2 deletions dnacenter/resource_event_subscription_syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"reflect"
"time"

"log"

Expand Down Expand Up @@ -914,7 +913,6 @@ func searchEventManagementGetSyslogEventSubscriptions(m interface{}, queryParams
nResponse, _, err := client.EventManagement.GetSyslogEventSubscriptions(nil)
maxPageSize := len(*nResponse)
for len(*nResponse) > 0 {
time.Sleep(15 * time.Second)
for _, item := range *nResponse {
if vID == item.SubscriptionID {
foundItem = &item
Expand Down
2 changes: 1 addition & 1 deletion dnacenter/resource_global_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ func searchNetworkSettingsGetGlobalPool(m interface{}, queryParams dnacentersdkg
queryParams.Limit = maxPageSize
offset += maxPageSize
queryParams.Offset = offset
time.Sleep(15 * time.Second)

nResponse, _, err = client.NetworkSettings.GetGlobalPool(&queryParams)
}
return &foundItems, err
Expand Down
1 change: 0 additions & 1 deletion dnacenter/resource_reserve_ip_subpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ func searchNetworkSettingsGetReserveIPSubpool(m interface{}, queryParams dnacent
queryParams.Limit = maxPageSize
offset += maxPageSize
queryParams.Offset = offset
time.Sleep(15 * time.Second)
nResponse, _, err = client.NetworkSettings.GetReserveIPSubpool(&queryParams)
}
return foundItem, err
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/data-sources/dnacenter_app_policy/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dnacenter = {
version = "1.1.19-beta"
version = "1.1.20-beta"
source = "hashicorp.com/edu/dnacenter"
# "hashicorp.com/edu/dnacenter" is the local built source, change to "cisco-en-programmability/dnacenter" to use downloaded version from registry
}
Expand Down
Loading

0 comments on commit 83362a5

Please sign in to comment.