Skip to content

Commit

Permalink
Merge pull request #517 from F5Networks/devel
Browse files Browse the repository at this point in the history
updated as3 resource to fix tenant_filter issue
  • Loading branch information
RavinderReddyF5 authored Jun 23, 2021
2 parents 3f9cbd2 + 263a63f commit 4486fdf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 23 additions & 2 deletions bigip/resource_bigip_as3.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func resourceBigipAs3Create(d *schema.ResourceData, meta interface{}) error {
tenantList, _, applicationList := client.GetTenantList(as3Json)
tenantCount := strings.Split(tenantList, ",")
if tenantFilter != "" {
log.Printf("[DEBUG] tenantFilter:%+v", tenantFilter)
if !contains(tenantCount, tenantFilter) {
return fmt.Errorf("tenant_filter: (%s) not exist in as3_json provided ", tenantFilter)
}
tenantList = tenantFilter
}
_ = d.Set("tenant_list", tenantList)
Expand Down Expand Up @@ -253,7 +257,11 @@ func resourceBigipAs3Exists(d *schema.ResourceData, meta interface{}) (bool, err
applicationList := d.Get("application_list").(string)
tenantFilter := d.Get("tenant_filter").(string)
if tenantFilter != "" {
name = tenantFilter
if !contains(strings.Split(name, ","), tenantFilter) {
log.Printf("[WARNING]tenant_filter: (%s) not exist in as3_json provided ", tenantFilter)
} else {
name = tenantFilter
}
}
as3Resp, err := client.GetAs3(name, applicationList)
if err != nil {
Expand Down Expand Up @@ -299,7 +307,11 @@ func resourceBigipAs3Update(d *schema.ResourceData, meta interface{}) error {
}
}
} else {
tenantList = tenantFilter
if !contains(strings.Split(tenantList, ","), tenantFilter) {
log.Printf("[WARNING]tenant_filter: (%s) not exist in as3_json provided ", tenantFilter)
} else {
tenantList = tenantFilter
}
}
strTrimSpace, err := client.AddTeemAgent(as3Json)
if err != nil {
Expand Down Expand Up @@ -343,3 +355,12 @@ func resourceBigipAs3Delete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}

func contains(s []string, str string) bool {
for _, v := range s {
if v == str {
return true
}
}
return false
}
2 changes: 1 addition & 1 deletion bigip/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bigip

// ProviderVersion is set at build-time in the release process
var ProviderVersion = "1.9.0"
var ProviderVersion = "1.10.0"

0 comments on commit 4486fdf

Please sign in to comment.