Skip to content

Commit

Permalink
Development Idle Connection Timeout (IBM-Cloud#4399)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunithaGudisagarIBM authored and IBM-diksha committed Mar 17, 2023
1 parent d70db30 commit 019b80d
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 13 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/IBM/continuous-delivery-go-sdk v1.0.4
github.com/IBM/event-notifications-go-admin-sdk v0.1.7
github.com/IBM/eventstreams-go-sdk v1.2.0
github.com/IBM/go-sdk-core/v5 v5.10.2
github.com/IBM/go-sdk-core/v5 v5.12.1
github.com/IBM/ibm-cos-sdk-go v1.9.0
github.com/IBM/ibm-cos-sdk-go-config v1.2.0
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1
Expand All @@ -28,7 +28,7 @@ require (
github.com/IBM/scc-go-sdk/v4 v4.0.2
github.com/IBM/schematics-go-sdk v0.2.1
github.com/IBM/secrets-manager-go-sdk v1.0.49
github.com/IBM/vpc-go-sdk v0.32.0
github.com/IBM/vpc-go-sdk v0.33.0
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/Shopify/sarama v1.29.1
github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV
github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE=
github.com/IBM/go-sdk-core/v5 v5.10.2 h1:bfqhYNwwpJ3zJQSYpF3umhmRIKaa762itvJkTAWCCLU=
github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI=
github.com/IBM/go-sdk-core/v5 v5.12.1 h1:9hb9oosBma4+N05xmKmtAW13T1nfADMVYRE7fu06lZ0=
github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI=
github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY=
github.com/IBM/ibm-cos-sdk-go v1.9.0 h1:kXTLB9GBwks3+YZopYz/eRbdyeVl2BXFALeqtQ8Duoc=
github.com/IBM/ibm-cos-sdk-go v1.9.0/go.mod h1:Oi8AC5WNDhmUJgbo1GL2FtBdo0nRgbzE/1HmCL1SERU=
Expand Down Expand Up @@ -101,6 +103,8 @@ github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230305091308-c49f01893314 h1:O
github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230305091308-c49f01893314/go.mod h1:QyDSznC6gJEXIGaj+JPxoEVtyXfkaxzId87mxcEb+vM=
github.com/IBM/vpc-go-sdk v0.32.0 h1:LDuU8xkeBISvLc6/artN7aQ1YsdKvDWRXalfsPHUBu4=
github.com/IBM/vpc-go-sdk v0.32.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ=
github.com/IBM/vpc-go-sdk v0.33.0 h1:HU0yEQmMGQoODlFJIAiQAOp2vE4i2PUvnjdcd8/9Kyw=
github.com/IBM/vpc-go-sdk v0.33.0/go.mod h1:Ozn0YBCs284Qvy+CNAmoLhh2eD48NnobiAyfgVd8wmA=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
Expand Down Expand Up @@ -896,6 +900,8 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk=
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -985,10 +991,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1000,6 +1010,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/vpc/data_source_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ func dataSourceInstanceDisksToMap(disksItem vpcv1.InstanceDisk) (disksMap map[st

return disksMap
}
func dataSourceInstanceFlattenLifecycleReasons(lifecycleReasons []vpcv1.LifecycleReason) (lifecycleReasonsList []map[string]interface{}) {
func dataSourceInstanceFlattenLifecycleReasons(lifecycleReasons []vpcv1.InstanceLifecycleReason) (lifecycleReasonsList []map[string]interface{}) {
lifecycleReasonsList = make([]map[string]interface{}, 0)
for _, lr := range lifecycleReasons {
currentLR := map[string]interface{}{}
Expand Down
10 changes: 10 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_lb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ func DataSourceIBMISLBListener() *schema.Resource {
Computed: true,
Description: "The provisioning status of this listener.",
},
isLBListenerIdleConnectionTimeout: {
Type: schema.TypeInt,
Computed: true,
Description: "idle connection timeout of listener",
},
},
}
}
Expand Down Expand Up @@ -248,6 +253,11 @@ func dataSourceIBMIsLbListenerRead(context context.Context, d *schema.ResourceDa
return diag.FromErr(fmt.Errorf("Error setting connection_limit: %s", err))
}
}
if loadBalancerListener.IdleConnectionTimeout != nil {
if err = d.Set(isLBListenerIdleConnectionTimeout, flex.IntValue(loadBalancerListener.IdleConnectionTimeout)); err != nil {
return diag.FromErr(fmt.Errorf("Error setting idle_connection_timeout: %s", err))
}
}
if err = d.Set("created_at", loadBalancerListener.CreatedAt.String()); err != nil {
return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err))
}
Expand Down
5 changes: 5 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_lb_listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ func DataSourceIBMISLBListeners() *schema.Resource {
Computed: true,
Description: "The provisioning status of this listener.",
},
isLBListenerIdleConnectionTimeout: {
Type: schema.TypeInt,
Computed: true,
Description: "idle connection timeout of listener",
},
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions ibm/service/vpc/resource_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ func instanceCreateByImage(d *schema.ResourceData, meta interface{}, profile, na
}
if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok {
hostFailure := availablePolicyItem.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &hostFailure,
}
}
Expand Down Expand Up @@ -1511,7 +1511,7 @@ func instanceCreateByCatalogOffering(d *schema.ResourceData, meta interface{}, p
}
if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok {
hostFailure := availablePolicyItem.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &hostFailure,
}
}
Expand Down Expand Up @@ -1894,7 +1894,7 @@ func instanceCreateByTemplate(d *schema.ResourceData, meta interface{}, profile,
}
if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok {
hostFailure := availablePolicyItem.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &hostFailure,
}
}
Expand Down Expand Up @@ -2520,7 +2520,7 @@ func instanceCreateByVolume(d *schema.ResourceData, meta interface{}, profile, n
}
if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok {
hostFailure := availablePolicyItem.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &hostFailure,
}
}
Expand Down
4 changes: 2 additions & 2 deletions ibm/service/vpc/resource_ibm_is_instance_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ func instanceTemplateCreateByCatalogOffering(d *schema.ResourceData, meta interf
}
if availablePolicyHostFailureIntf, ok := d.GetOk(isInstanceTemplateAvailablePolicyHostFailure); ok {
availablePolicyHostFailure := availablePolicyHostFailureIntf.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &availablePolicyHostFailure,
}
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ func instanceTemplateCreate(d *schema.ResourceData, meta interface{}, profile, n
}
if availablePolicyHostFailureIntf, ok := d.GetOk(isInstanceTemplateAvailablePolicyHostFailure); ok {
availablePolicyHostFailure := availablePolicyHostFailureIntf.(string)
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{
instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{
HostFailure: &availablePolicyHostFailure,
}
}
Expand Down
37 changes: 33 additions & 4 deletions ibm/service/vpc/resource_ibm_is_lb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
isLBListenerHTTPSRedirectListener = "https_redirect_listener"
isLBListenerHTTPSRedirectStatusCode = "https_redirect_status_code"
isLBListenerHTTPSRedirectURI = "https_redirect_uri"
isLBListenerIdleConnectionTimeout = "idle_connection_timeout"
)

func ResourceIBMISLBListener() *schema.Resource {
Expand All @@ -62,6 +63,14 @@ func ResourceIBMISLBListener() *schema.Resource {
Description: "Loadbalancer listener ID",
},

isLBListenerIdleConnectionTimeout: {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "idle connection timeout of listener",
ValidateFunc: validate.InvokeValidator("ibm_is_lb_listener", isLBListenerIdleConnectionTimeout),
},

isLBListenerPort: {
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -189,7 +198,13 @@ func ResourceIBMISLBListenerValidator() *validate.ResourceValidator {
Type: validate.TypeString,
Required: true,
AllowedValues: protocol})

validateSchema = append(validateSchema,
validate.ValidateSchema{
Identifier: isLBListenerIdleConnectionTimeout,
ValidateFunctionIdentifier: validate.IntBetween,
Type: validate.TypeInt,
MinValue: "50",
MaxValue: "7200"})
ibmISLBListenerResourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_lb_listener", Schema: validateSchema}
return &ibmISLBListenerResourceValidator
}
Expand All @@ -211,6 +226,10 @@ func resourceIBMISLBListenerCreate(d *schema.ResourceData, meta interface{}) err
defPool = lbPool
}

var idleConnectionTimeout int64
if idleconnectiontimeout, ok := d.GetOk(isLBListenerIdleConnectionTimeout); ok {
idleConnectionTimeout = int64(idleconnectiontimeout.(int))
}
if crn, ok := d.GetOk(isLBListenerCertificateInstance); ok {
certificateCRN = crn.(string)
}
Expand Down Expand Up @@ -243,15 +262,15 @@ func resourceIBMISLBListenerCreate(d *schema.ResourceData, meta interface{}) err
conns.IbmMutexKV.Lock(isLBKey)
defer conns.IbmMutexKV.Unlock(isLBKey)

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

return resourceIBMISLBListenerRead(d, meta)
}

func lbListenerCreate(d *schema.ResourceData, meta interface{}, lbID, protocol, defPool, certificateCRN, listener, uri string, port, portMin, portMax, connLimit, httpStatusCode int64) error {
func lbListenerCreate(d *schema.ResourceData, meta interface{}, lbID, protocol, defPool, certificateCRN, listener, uri string, port, portMin, portMax, connLimit, httpStatusCode, idleConnectionTimeout int64) error {
sess, err := vpcClient(meta)
if err != nil {
return err
Expand Down Expand Up @@ -303,6 +322,9 @@ func lbListenerCreate(d *schema.ResourceData, meta interface{}, lbID, protocol,
}
}
}
if strings.EqualFold(*lb.Profile.Family, "application") {
options.IdleConnectionTimeout = &idleConnectionTimeout
}

if app, ok := d.GetOk(isLBListenerAcceptProxyProtocol); ok {
acceptProxyProtocol := app.(bool)
Expand Down Expand Up @@ -461,6 +483,9 @@ func lbListenerGet(d *schema.ResourceData, meta interface{}, lbID, lbListenerID
getLoadBalancerOptions := &vpcv1.GetLoadBalancerOptions{
ID: &lbID,
}
if lbListener.IdleConnectionTimeout != nil {
d.Set(isLBListenerIdleConnectionTimeout, *lbListener.IdleConnectionTimeout)
}
lb, response, err := sess.GetLoadBalancer(getLoadBalancerOptions)
if err != nil {
return fmt.Errorf("[ERROR] Error Getting Load Balancer : %s\n%s", err, response)
Expand Down Expand Up @@ -580,7 +605,11 @@ func lbListenerUpdate(d *schema.ResourceData, meta interface{}, lbID, lbListener
loadBalancerListenerPatchModel.ConnectionLimit = &connLimit
hasChanged = true
}

if d.HasChange(isLBListenerIdleConnectionTimeout) {
idleConnectionTimeout := int64(d.Get(isLBListenerIdleConnectionTimeout).(int))
loadBalancerListenerPatchModel.IdleConnectionTimeout = &idleConnectionTimeout
hasChanged = true
}
if hasChanged {
loadBalancerListenerPatch, err := loadBalancerListenerPatchModel.AsPatch()
if err != nil {
Expand Down
74 changes: 74 additions & 0 deletions ibm/service/vpc/resource_ibm_is_lb_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,55 @@ func TestAccIBMISLBListener_basic_udp(t *testing.T) {
},
})
}
func TestAccIBMISLBListener_connTimeout(t *testing.T) {
var lb string
vpcname := fmt.Sprintf("tflblis-vpc-%d", acctest.RandIntRange(10, 100))
subnetname := fmt.Sprintf("tflblis-subnet-%d", acctest.RandIntRange(10, 100))
lbname := fmt.Sprintf("tflblis%d", acctest.RandIntRange(10, 100))

protocol1 := "http"
port1 := "8080"

protocol2 := "tcp"
port2 := "9080"

resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
CheckDestroy: testAccCheckIBMISLBListenerDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckIBMISLBListenerConfigIdealConnTimeout(vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, lbname, port1, protocol1, "900"),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMISLBListenerExists("ibm_is_lb_listener.testacc_lb_listener", lb),
resource.TestCheckResourceAttr(
"ibm_is_lb.testacc_LB", "name", lbname),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "port", port1),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "protocol", protocol1),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "accept_proxy_protocol", "true"),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "idle_connection_timeout", "900"),
),
},

{
Config: testAccCheckIBMISLBListenerConfigIdealConnTimeout(vpcname, subnetname, acc.ISZoneName, acc.ISCIDR, lbname, port2, protocol2, "800"),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMISLBListenerExists("ibm_is_lb_listener.testacc_lb_listener", lb),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "port", port2),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "protocol", protocol2),
resource.TestCheckResourceAttr(
"ibm_is_lb_listener.testacc_lb_listener", "idle_connection_timeout", "800"),
),
},
},
})
}
func TestAccIBMISNLBRouteModeListener_basic(t *testing.T) {
var lb string
vpcname := fmt.Sprintf("tflblis-vpc-%d", acctest.RandIntRange(10, 100))
Expand Down Expand Up @@ -337,6 +386,31 @@ func testAccCheckIBMISLBListenerConfig(vpcname, subnetname, zone, cidr, lbname,
accept_proxy_protocol = true
}`, vpcname, subnetname, zone, cidr, lbname, port, protocol)

}
func testAccCheckIBMISLBListenerConfigIdealConnTimeout(vpcname, subnetname, zone, cidr, lbname, port, protocol, timeout string) string {
return fmt.Sprintf(`
resource "ibm_is_vpc" "testacc_vpc" {
name = "%s"
}
resource "ibm_is_subnet" "testacc_subnet" {
name = "%s"
vpc = "${ibm_is_vpc.testacc_vpc.id}"
zone = "%s"
ipv4_cidr_block = "%s"
}
resource "ibm_is_lb" "testacc_LB" {
name = "%s"
subnets = ["${ibm_is_subnet.testacc_subnet.id}"]
}
resource "ibm_is_lb_listener" "testacc_lb_listener" {
lb = "${ibm_is_lb.testacc_LB.id}"
port = %s
protocol = "%s"
idle_connection_timeout = "%s"
accept_proxy_protocol = true
}`, vpcname, subnetname, zone, cidr, lbname, port, protocol, timeout)

}
func testAccCheckIBMISLBUdpListenerConfig(vpcname, subnetname, zone, cidr, lbname, port, protocol string) string {
return fmt.Sprintf(`
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/is_lb_listener.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ In addition to all argument references listed, you can access the following attr
- `id` - (String) The unique identifier for this load balancer listener.
- `uri` - (String) The redirect relative target URI.

- `idle_connection_timeout` - The idle connection timeout of the listener in seconds. This property will be present for load balancers in the `application` family. Default value is `50`.

- `policies` - (List) The policies for this listener.
Nested scheme for `policies`:
- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_lb_listeners.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ In addition to all argument references listed, you can access the following attr
- `id` - (String) The unique identifier for this load balancer listener.
- `uri` - (String) The redirect relative target URI.
- `id` - (String) The unique identifier for this load balancer listener.
- `idle_connection_timeout` - The idle connection timeout of the listener in seconds. This property will be present for load balancers in the `application` family. Default value is `50`.
- `policies` - (List) The policies for this listener.
Nested scheme for `policies`:
- `deleted` - (List) If present, this property indicates the referenced resource has been deleted and providessome supplementary information.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_lb_listener.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Review the argument references that you can specify for your resource.
- `https_redirect_listener` - (Optional, String) ID of the listener that will be set as http redirect target.
- `https_redirect_status_code` - (Optional, Integer) The HTTP status code to be returned in the redirect response, one of [301, 302, 303, 307, 308].
- `https_redirect_uri` - (Optional, String) Target URI where traffic will be redirected.
- `idle_connection_timeout` - (Optional, Integer) The idle connection timeout of the listener in seconds. This property will be present for load balancers in the `application` family. Default value is `50`.

## Attribute reference
In addition to all argument reference list, you can access the following attribute reference after your resource is created.
Expand Down

0 comments on commit 019b80d

Please sign in to comment.