Skip to content

Commit

Permalink
Merge pull request #1010 from F5Networks/issue-993
Browse files Browse the repository at this point in the history
Fixed a persistence_profiles bug in virtual server resource
  • Loading branch information
RavinderReddyF5 authored Sep 4, 2024
2 parents caa46c9 + b3befa6 commit d1eabd0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bigip/resource_bigip_ltm_virtual_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,20 @@ func resourceBigipLtmVirtualServerRead(ctx context.Context, d *schema.ResourceDa
_ = d.Set("translate_port", vs.TranslatePort)
_ = d.Set("firewall_enforced_policy", vs.FwEnforcedPolicy)

if len(vs.PersistenceProfiles) > 0 {
default_persistence := fmt.Sprintf("/%s/%s", vs.PersistenceProfiles[0].Partition, vs.PersistenceProfiles[0].Name)
_ = d.Set("default_persistence_profile", default_persistence)
}
profileNames := schema.NewSet(schema.HashString, make([]interface{}, 0, len(vs.PersistenceProfiles)))
for _, profile := range vs.PersistenceProfiles {
FullProfileName := "/" + profile.Partition + "/" + profile.Name
profileNames.Add(FullProfileName)
}
if profileNames.Len() > 0 {
if _, ok := d.GetOk("persistence_profiles"); ok {
_ = d.Set("persistence_profiles", profileNames)
_ = d.Set("fallback_persistence_profile", vs.FallbackPersistenceProfile)
}
_ = d.Set("persistence_profiles", profileNames)
}

_ = d.Set("fallback_persistence_profile", vs.FallbackPersistenceProfile)
_ = d.Set("source_port", vs.SourcePort)
_ = d.Set("vlans_enabled", vs.VlansEnabled)
profiles, err := client.VirtualServerProfiles(name)
Expand Down

0 comments on commit d1eabd0

Please sign in to comment.