Skip to content

Commit

Permalink
lb listener access protocol issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
uibm authored and hkantare committed Oct 22, 2021
1 parent 2f8eb13 commit c81d4d1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ibm/resource_ibm_is_lb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ func resourceIBMISLBListenerCreate(d *schema.ResourceData, meta interface{}) err
lbID := d.Get(isLBListenerLBID).(string)
port := int64(d.Get(isLBListenerPort).(int))
protocol := d.Get(isLBListenerProtocol).(string)
acceptProxyProtocol := d.Get(isLBListenerAcceptProxyProtocol).(bool)
var defPool, certificateCRN string
if pool, ok := d.GetOk(isLBListenerDefaultPool); ok {
lbPool, err := getPoolId(pool.(string))
Expand Down Expand Up @@ -221,25 +220,31 @@ func resourceIBMISLBListenerCreate(d *schema.ResourceData, meta interface{}) err
ibmMutexKV.Lock(isLBKey)
defer ibmMutexKV.Unlock(isLBKey)

err := lbListenerCreate(d, meta, lbID, protocol, defPool, certificateCRN, listener, uri, port, connLimit, httpStatusCode, acceptProxyProtocol)
err := lbListenerCreate(d, meta, lbID, protocol, defPool, certificateCRN, listener, uri, port, connLimit, httpStatusCode)
if err != nil {
return err
}

return resourceIBMISLBListenerRead(d, meta)
}

func lbListenerCreate(d *schema.ResourceData, meta interface{}, lbID, protocol, defPool, certificateCRN, listener, uri string, port, connLimit, httpStatusCode int64, acceptProxyProtocol bool) error {
func lbListenerCreate(d *schema.ResourceData, meta interface{}, lbID, protocol, defPool, certificateCRN, listener, uri string, port, connLimit, httpStatusCode int64) error {
sess, err := vpcClient(meta)
if err != nil {
return err
}

options := &vpcv1.CreateLoadBalancerListenerOptions{
LoadBalancerID: &lbID,
Port: &port,
Protocol: &protocol,
AcceptProxyProtocol: &acceptProxyProtocol,
LoadBalancerID: &lbID,
Port: &port,
Protocol: &protocol,
}

if app, ok := d.GetOk(isLBListenerAcceptProxyProtocol); ok {
acceptProxyProtocol := app.(bool)
options.AcceptProxyProtocol = &acceptProxyProtocol
}

if defPool != "" {
options.DefaultPool = &vpcv1.LoadBalancerPoolIdentity{
ID: &defPool,
Expand Down

0 comments on commit c81d4d1

Please sign in to comment.