Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrated vpc-go-sdk to 0.49.1 version #5223

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/IBM/schematics-go-sdk v0.2.3
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4
github.com/IBM/vpc-beta-go-sdk v0.6.0
github.com/IBM/vpc-go-sdk v0.48.0
github.com/IBM/vpc-go-sdk v0.49.1
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40=
github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc=
github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA=
github.com/IBM/vpc-go-sdk v0.48.0 h1:4yeSxVX9mizsIW2F0rsVI47rZoNKBrZ1QK9RwwRas9Q=
github.com/IBM/vpc-go-sdk v0.48.0/go.mod h1:FDJpiokOmaYG2hNYDfqKVxUPe8mm/dPi3mdz8Zt4o/Q=
github.com/IBM/vpc-go-sdk v0.49.1 h1:VIkZ8iJMBHqBulUXcPtN0ifxsa0xwlBtaLslU2V9HsY=
github.com/IBM/vpc-go-sdk v0.49.1/go.mod h1:iBg9UJY1y/XpkweyP6YH7G6guzKPV8BYDoBMTdPupH4=
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *v
return modelMap, nil
}

func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) {
func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
modelMap["crn"] = model.CRN
if model.Deleted != nil {
Expand Down
388 changes: 313 additions & 75 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go

Large diffs are not rendered by default.

89 changes: 41 additions & 48 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "name"),
Expand All @@ -51,8 +49,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "name"),
Expand All @@ -71,8 +67,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "name"),
Expand All @@ -91,8 +85,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "name"),
Expand All @@ -108,45 +100,46 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {

func testAccCheckIBMIsVPNGatewayConnectionDataSourceConfigBasic(vpc, subnet, vpngwname, name string) string {
return fmt.Sprintf(`
resource "ibm_is_vpc" "example" {
name = "%s"

}
resource "ibm_is_subnet" "example" {
name = "%s"
vpc = "${ibm_is_vpc.example.id}"
zone = "%s"
ipv4_cidr_block = "%s"

}
resource "ibm_is_vpn_gateway" "example" {
name = "%s"
subnet = "${ibm_is_subnet.example.id}"


}
resource "ibm_is_vpn_gateway_connection" "example" {
name = "%s"
vpn_gateway = "${ibm_is_vpn_gateway.example.id}"
peer_address = "1.2.3.4"
local_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
preshared_key = "VPNDemoPassword"
}
data "ibm_is_vpn_gateway_connection" "example" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example1" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
data "ibm_is_vpn_gateway_connection" "example2" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example3" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
resource "ibm_is_vpc" "example" {
name = "%s"

}
resource "ibm_is_subnet" "example" {
name = "%s"
vpc = ibm_is_vpc.example.id
zone = "%s"
ipv4_cidr_block = "%s"

}
resource "ibm_is_vpn_gateway" "example" {
name = "%s"
subnet = ibm_is_subnet.example.id
mode = "policy"

}
resource "ibm_is_vpn_gateway_connection" "example" {
name = "%s"
vpn_gateway = ibm_is_vpn_gateway.example.id
peer_address = "1.2.3.4"
peer_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
local_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
preshared_key = "VPNDemoPassword"
}
data "ibm_is_vpn_gateway_connection" "example" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example1" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
data "ibm_is_vpn_gateway_connection" "example2" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example3" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
`, vpc, subnet, acc.ISZoneName, acc.ISCIDR, vpngwname, name)
}
186 changes: 148 additions & 38 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,51 +197,161 @@ func dataSourceIBMVPNGatewayConnectionsRead(d *schema.ResourceData, meta interfa
return fmt.Errorf("[ERROR] Error reading list of VPN Gateway Connections:%s\n%s", err, detail)
}
vpngatewayconnections := make([]map[string]interface{}, 0)
for _, instance := range availableVPNGatewayConnections.Connections {
for _, vpnGatewayConnectionIntf := range availableVPNGatewayConnections.Connections {
gatewayconnection := map[string]interface{}{}
data := instance.(*vpcv1.VPNGatewayConnection)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID
if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
} else {
return fmt.Errorf("[ERROR] Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")
}

vpngatewayconnections = append(vpngatewayconnections, gatewayconnection)
Expand Down
Loading
Loading