diff --git a/CHANGELOG.md b/CHANGELOG.md index f1485fc8..d20836c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ### Bug fixes & Enhancements: - [#29] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/29) Add Description and Bios settings to server template - [#63] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/63) Create util function to get scope by name while creating a resource instead of hardcoding it +- [#162] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/162) Logical Interconnect Group dependentResourceUri error. # [v1.4.0] ### Notes diff --git a/examples/logical_interconnect_group.tf b/examples/logical_interconnect_group.tf index b885a4bd..5e4b00aa 100644 --- a/examples/logical_interconnect_group.tf +++ b/examples/logical_interconnect_group.tf @@ -7,7 +7,6 @@ provider "oneview" { ov_ifmatch = "*" } - /* # Creates a logical interconnect group or updates if already existing resource "oneview_logical_interconnect_group" "LIG" { diff --git a/oneview/resource_logical_interconnect_group.go b/oneview/resource_logical_interconnect_group.go index c2f26a93..178037f4 100644 --- a/oneview/resource_logical_interconnect_group.go +++ b/oneview/resource_logical_interconnect_group.go @@ -505,6 +505,10 @@ func resourceLogicalInterconnectGroup() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "dependent_resource_uri": { + Type: schema.TypeString, + Computed: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -2119,6 +2123,8 @@ func resourceLogicalInterconnectGroupUpdate(d *schema.ResourceData, meta interfa lig.SnmpConfiguration = &snmpConfiguration } + ligCall, _ := config.ovClient.GetLogicalInterconnectGroupByName(d.Get("name").(string)) + interconnectSettingsPrefix := fmt.Sprintf("interconnect_settings.0") if val, ok := d.GetOk(interconnectSettingsPrefix + ".type"); ok { interconnectSettings := ov.EthernetSettings{} @@ -2145,91 +2151,41 @@ func resourceLogicalInterconnectGroupUpdate(d *schema.ResourceData, meta interfa if val1, ok := d.GetOk(interconnectSettingsPrefix + ".mac_refresh_interval"); ok { interconnectSettings.MacRefreshInterval = val1.(int) } - + interconnectSettings.DependentResourceUri = ligCall.EthernetSettings.DependentResourceUri interconnectSettings.Type = val.(string) lig.EthernetSettings = &interconnectSettings } - igmpSettingsPrefix := fmt.Sprintf("igmp_settings.0") - - if val, ok := d.GetOk(igmpSettingsPrefix + ".type"); ok { - igmpSettings := ov.IgmpSettings{} - - consistencyChecking := d.Get(igmpSettingsPrefix + ".consistency_checking").(string) - igmpSettings.ConsistencyChecking = consistencyChecking - - igmpSnooping := d.Get(igmpSettingsPrefix + ".igmp_snooping").(bool) - igmpSettings.EnableIgmpSnooping = &igmpSnooping - - preventFlooding := d.Get(igmpSettingsPrefix + ".prevent_flooding").(bool) - igmpSettings.EnablePreventFlooding = &preventFlooding - - proxyReporting := d.Get(igmpSettingsPrefix + ".proxy_reporting").(bool) - igmpSettings.EnableProxyReporting = &proxyReporting - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".created"); ok { - enabled := val1.(string) - igmpSettings.Created = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".description"); ok { - enabled := val1.(string) - igmpSettings.Description = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".id"); ok { - enabled := val1.(string) - igmpSettings.ID = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".etag"); ok { - enabled := utils.NewNstring(val1.(string)) - igmpSettings.ETAG = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".igmp_idle_timeout_interval"); ok { - enabled := val1.(int) - igmpSettings.IgmpIdleTimeoutInterval = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".igmp_snooping_vlan_ids"); ok { - enabled := val1.(string) - igmpSettings.IgmpSnoopingVlanIds = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".modified"); ok { - enabled := val1.(string) - igmpSettings.Modified = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".name"); ok { - enabled := val1.(string) - igmpSettings.Name = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".state"); ok { - enabled := val1.(string) - igmpSettings.State = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".status"); ok { - enabled := val1.(string) - igmpSettings.Status = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".category"); ok { - enabled := utils.NewNstring(val1.(string)) - igmpSettings.Category = enabled - } - - if val1, ok := d.GetOk(igmpSettingsPrefix + ".uri"); ok { - enabled := utils.NewNstring(val1.(string)) - igmpSettings.URI = enabled - } - - igmpSettings.Type = val.(string) - lig.IgmpSettings = &igmpSettings - } + rawigmpsetting := d.Get("igmp_settings").(*schema.Set).List() + igmpSetting := ov.IgmpSettings{} + for _, val := range rawigmpsetting { + + rawlval := val.(map[string]interface{}) + + enableigmpsnooping := rawlval["igmp_snooping"].(bool) + enablepreventflooding := rawlval["prevent_flooding"].(bool) + enableproxyreporting := rawlval["proxy_reporting"].(bool) + + igmpSetting.Created = rawlval["created"].(string) + igmpSetting.Category = utils.Nstring(rawlval["category"].(string)) + igmpSetting.Type = rawlval["type"].(string) + igmpSetting.ConsistencyChecking = rawlval["consistency_checking"].(string) + igmpSetting.DependentResourceUri = ligCall.IgmpSettings.DependentResourceUri + igmpSetting.Description = rawlval["description"].(string) + igmpSetting.ETAG = utils.Nstring(rawlval["etag"].(string)) + igmpSetting.EnableIgmpSnooping = &enableigmpsnooping + igmpSetting.EnablePreventFlooding = &enablepreventflooding + igmpSetting.EnableProxyReporting = &enableproxyreporting + igmpSetting.ID = rawlval["id"].(string) + igmpSetting.IgmpIdleTimeoutInterval = rawlval["igmp_idle_timeout_interval"].(int) + igmpSetting.IgmpSnoopingVlanIds = rawlval["igmp_snooping_vlan_ids"].(string) + igmpSetting.Modified = rawlval["modified"].(string) + igmpSetting.Name = rawlval["name"].(string) + igmpSetting.State = rawlval["state"].(string) + igmpSetting.Status = rawlval["status"].(string) + igmpSetting.URI = utils.Nstring(rawlval["uri"].(string)) + } + lig.IgmpSettings = &igmpSetting qualityOfServicePrefix := fmt.Sprintf("quality_of_service.0") activeQosConfig := ov.ActiveQosConfig{}