Skip to content

Commit

Permalink
Merge pull request #240 from cisco-en-programmability/develop
Browse files Browse the repository at this point in the history
Develop v1.1.27-beta
  • Loading branch information
fmunozmiranda authored Nov 20, 2023
2 parents 33753cb + 8fb0369 commit b5e4182
Show file tree
Hide file tree
Showing 195 changed files with 268 additions and 229 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1.27-beta (November 20, 2023)
BUGFIXES:
* Resource `dnacenter_reserve_ip_subpool` does not detect changes made outside terraform - updating parameter can be updated. #217
* `dnacenter_wireless_profiles` does not properly read or synchronizes to state - sites are not mapped with GET API. #233

## 1.1.26-beta (November 14, 2023)
BUGFIXES:
* Resource `dnacenter_reserve_ip_subpool` does not detect changes made outside terraform #217
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.26-beta
VERSION=1.1.27-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.26-beta |
| 2.3.5.3 | 1.1.27-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.26-beta"
version = "1.1.27-beta"
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions dnacenter/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dnacenter
import (
"encoding/json"
"fmt"
"log"
"strconv"
)

Expand Down Expand Up @@ -91,9 +92,27 @@ func getResourceItem(item interface{}) *map[string]interface{} {
return &vvItem
}

func sliceInterfaceToSliceString(v []interface{}) []string {
newValue := []string{}
for _, v2 := range v {
value, ok := v2.([]interface{})
if !ok {
log.Print("sliceInterfaceToSliceString: Nil")
return nil
}

for _, i := range value {
newValue = append(newValue, interfaceToString(i))
}
}
return newValue
}

func interfaceToSliceString(v interface{}) []string {
value, ok := v.([]interface{})
log.Printf("interfaceToSliceString interface: %s", responseInterfaceToSliceString(v))
if !ok {
log.Print("interfaceToSliceString: Nil")
return nil
}
newValue := []string{}
Expand Down
34 changes: 29 additions & 5 deletions dnacenter/data_source_reserve_ip_subpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func flattenNetworkSettingsGetReserveIPSubpoolParameters(items *dnacentersdkgo.R
respItem["ipv6_address_space"] = boolPtrToString(items.IPv6AddressSpace)
respItem["ipv4_global_pool"] = items.IPv4GlobalPool
respItem["ipv4_prefix"] = boolPtrToString(items.IPv4Prefix)
respItem["ipv4_prefix_length"] = interfaceToIntPtr(items.IPv4PrefixLength)
respItem["ipv4_prefix_length"] = items.IPv4PrefixLength
respItem["ipv4_subnet"] = items.IPv4Subnet
respItem["ipv4_gate_way"] = items.IPv4GateWay
respItem["ipv4_dhcp_servers"] = items.IPv4DhcpServers
Expand All @@ -352,6 +352,30 @@ func flattenNetworkSettingsGetReserveIPSubpoolParameters(items *dnacentersdkgo.R
return respItems
}

func flattenNetworkSettingsGetReserveIPSubpoolParametersDhcpServers(items []string) []interface{} {
if items == nil {
return nil
}
var respItems []interface{}
for _, item := range items {
respItem := item
respItems = append(respItems, responseInterfaceToString(respItem))
}
return respItems
}

func flattenNetworkSettingsGetReserveIPSubpoolParametersDnsServers(items []string) []interface{} {
if items == nil {
return nil
}
var respItems []interface{}
for _, item := range items {
respItem := item
respItems = append(respItems, responseInterfaceToString(respItem))
}
return respItems
}

func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPools(items *[]dnacentersdkgo.ResponseNetworkSettingsGetReserveIPSubpoolResponseIPPools) []map[string]interface{} {
if items == nil {
return nil
Expand Down Expand Up @@ -384,12 +408,12 @@ func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPools(items *[]dnacentersdk
return respItems
}

func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPoolsDhcpServerIPs(items *[]dnacentersdkgo.ResponseNetworkSettingsGetReserveIPSubpoolResponseIPPoolsDhcpServerIPs) []interface{} {
func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPoolsDhcpServerIPs(items []string) []interface{} {
if items == nil {
return nil
}
var respItems []interface{}
for _, item := range *items {
for _, item := range items {
respItem := item
respItems = append(respItems, responseInterfaceToString(respItem))
}
Expand All @@ -406,12 +430,12 @@ func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPoolsClientOptions(item *dn

}

func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPoolsDNSServerIPs(items *[]dnacentersdkgo.ResponseNetworkSettingsGetReserveIPSubpoolResponseIPPoolsDNSServerIPs) []interface{} {
func flattenNetworkSettingsGetReserveIPSubpoolItemsIPPoolsDNSServerIPs(items []string) []interface{} {
if items == nil {
return nil
}
var respItems []interface{}
for _, item := range *items {
for _, item := range items {
respItem := item
respItems = append(respItems, responseInterfaceToString(respItem))
}
Expand Down
15 changes: 10 additions & 5 deletions dnacenter/resource_reserve_ip_subpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ func resourceReserveIPSubpoolRead(ctx context.Context, d *schema.ResourceData, m
return diags
}
request1 := expandRequestReserveIPSubpoolReserveIPSubpool(ctx, "parameters.0", d)
log.Printf("[DEBUG] Retrieved response %+v", responseInterfaceToString(*response1))
updatedParameters := updateReserveIpPoolParameters(request1, response1)

vParameters := flattenNetworkSettingsGetReserveIPSubpoolParameters(updatedParameters)
Expand Down Expand Up @@ -869,22 +870,26 @@ func searchNetworkSettingsGetReserveIPSubpool(m interface{}, queryParams dnacent
}

func updateReserveIpPoolParameters(request *dnacentersdkgo.RequestNetworkSettingsReserveIPSubpool, response *dnacentersdkgo.ResponseNetworkSettingsGetReserveIPSubpoolResponse) *dnacentersdkgo.RequestNetworkSettingsReserveIPSubpool {
log.Printf("IPPOOLREQUEST %s", responseInterfaceToString(request))
for _, v := range *response.IPPools {
// log.Printf("IPPOOL %s", responseInterfaceToString(v))
log.Printf("IPPOOL %s", responseInterfaceToString(v))
log.Printf("IPPOOL Dhcp %s", responseInterfaceToString(v.DhcpServerIPs))
if v.IPv6 != nil && *v.IPv6 {
if v.IPPoolName == request.Name {
request.Name = v.IPPoolName
request.IPv6DhcpServers = interfaceToSliceString(v.DhcpServerIPs)
request.IPv6DNSServers = interfaceToSliceString(v.DNSServerIPs)
request.IPv6DhcpServers = v.DhcpServerIPs
request.IPv6DNSServers = v.DNSServerIPs
}
// request.SLAacSupport =
} else {
if v.IPPoolName == request.Name {
request.Name = v.IPPoolName
request.IPv4DhcpServers = interfaceToSliceString(v.DhcpServerIPs)
request.IPv4DNSServers = interfaceToSliceString(v.DNSServerIPs)
request.IPv4DhcpServers = v.DhcpServerIPs
request.IPv4DNSServers = v.DNSServerIPs
}
}
}

log.Printf("IPPOOLREQUEST %s", responseInterfaceToString(request))
return request
}
3 changes: 1 addition & 2 deletions dnacenter/resource_wireless_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,14 @@ func resourceWirelessProfileRead(ctx context.Context, d *schema.ResourceData, m

request1 := expandRequestWirelessProfileCreateWirelessProfile(ctx, "parameters.0", d)
*resp[0].ProfileDetails.SSIDDetails = *orderSSIDDetails(*request1.ProfileDetails.SSIDDetails, *resp[0].ProfileDetails.SSIDDetails)

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

vItem1[0]["profile_details"].([]map[string]interface{})[0]["sites"] = request1.ProfileDetails.Sites
if err := d.Set("parameters", vItem1); err != nil {
diags = append(diags, diagError(
"Failure when setting GetWirelessProfile search response",
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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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.26-beta"
version = "1.1.27-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 b5e4182

Please sign in to comment.