Skip to content

Commit eb2776e

Browse files
Terraform Team AutomationNishtha Goel
authored andcommitted
Added session resumption support for LB
1 parent 28a4e82 commit eb2776e

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

examples/load_balancer/lb_full/lb_full.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ resource "oci_load_balancer_listener" "lb-listener2" {
461461
protocols = ["TLSv1.1", "TLSv1.2"]
462462
server_order_preference = "ENABLED"
463463
cipher_suite_name = oci_load_balancer_ssl_cipher_suite.test_ssl_cipher_suite.name
464+
has_session_resumption = true
464465
}
465466
}
466467

@@ -492,6 +493,7 @@ resource "oci_load_balancer_listener" "lb-listener4" {
492493
protocols = ["TLSv1.1", "TLSv1.2"]
493494
server_order_preference = "ENABLED"
494495
cipher_suite_name = oci_load_balancer_ssl_cipher_suite.test_ssl_cipher_suite3.name
496+
has_session_resumption = true
495497
}
496498
}
497499

internal/integrationtest/load_balancer_listener_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ var (
4343
listenerConnectionConfigurationRepresentation = map[string]interface{}{
4444
"idle_timeout_in_seconds": acctest.Representation{RepType: acctest.Required, Create: `10`, Update: `11`},
4545
}
46+
4647
listenerSslConfigurationRepresentationOciCerts = map[string]interface{}{
4748
// note: cannot specify certificate_name along with trusted_certificate_authority_ids
4849
"certificate_ids": acctest.Representation{RepType: acctest.Optional, Create: []string{certificateIds}, Update: []string{certificateIds2}},
50+
"has_session_resumption": acctest.Representation{RepType: acctest.Optional, Create: `false`, Update: `true`},
4951
"cipher_suite_name": acctest.Representation{RepType: acctest.Optional, Create: `oci-default-ssl-cipher-suite-v1`, Update: `oci-default-ssl-cipher-suite-v1`},
5052
"protocols": acctest.Representation{RepType: acctest.Optional, Create: []string{`TLSv1.2`}, Update: []string{`TLSv1.2`}},
5153
"server_order_preference": acctest.Representation{RepType: acctest.Optional, Create: `ENABLED`, Update: `DISABLED`},
@@ -297,6 +299,7 @@ func TestLoadBalancerListenerResourceLBCert_basic(t *testing.T) {
297299
resource.TestCheckResourceAttrSet(resourceName, "routing_policy_name"),
298300
resource.TestCheckResourceAttr(resourceName, "rule_set_names.#", "1"),
299301
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.#", "1"),
302+
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.has_session_resumption", "false"),
300303
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.certificate_name", "example_certificate_bundle"),
301304
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.cipher_suite_name", "oci-default-ssl-cipher-suite-v1"),
302305
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.protocols.#", "1"),
@@ -432,6 +435,7 @@ func TestLoadBalancerListenerResourceLBCertToOciCerts_combo(t *testing.T) {
432435
resource.TestCheckResourceAttrSet(resourceName, "routing_policy_name"),
433436
resource.TestCheckResourceAttr(resourceName, "rule_set_names.#", "1"),
434437
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.#", "1"),
438+
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.has_session_resumption", "true"),
435439
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.certificate_name.#", "0"),
436440
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.cipher_suite_name", "oci-default-ssl-cipher-suite-v1"),
437441
resource.TestCheckResourceAttr(resourceName, "ssl_configuration.0.protocols.#", "1"),

internal/service/load_balancer/load_balancer_backend_set_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,10 @@ func SSLConfigurationToMap(obj *oci_load_balancer.SslConfiguration) map[string]i
11221122

11231123
result["server_order_preference"] = string(obj.ServerOrderPreference)
11241124

1125+
if obj.HasSessionResumption != nil {
1126+
result["has_session_resumption"] = bool(*obj.HasSessionResumption)
1127+
}
1128+
11251129
if obj.TrustedCertificateAuthorityIds != nil {
11261130
result["trusted_certificate_authority_ids"] = obj.TrustedCertificateAuthorityIds
11271131
}

internal/service/load_balancer/load_balancer_listener_resource.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ func LoadBalancerListenerResource() *schema.Resource {
132132
Optional: true,
133133
Computed: true,
134134
},
135+
"has_session_resumption": {
136+
Type: schema.TypeBool,
137+
Optional: true,
138+
Computed: true,
139+
},
135140
"protocols": {
136141
Type: schema.TypeList,
137142
Optional: true,
@@ -715,6 +720,11 @@ func (s *LoadBalancerListenerResourceCrud) mapToSSLConfigurationDetails(fieldKey
715720
result.ServerOrderPreference = oci_load_balancer.SslConfigurationDetailsServerOrderPreferenceEnum(serverOrderPreference.(string))
716721
}
717722

723+
if hasSessionResumption, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "has_session_resumption")); ok {
724+
tmp := hasSessionResumption.(bool)
725+
result.HasSessionResumption = &tmp
726+
}
727+
718728
if trustedCertificateAuthorityIds, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "trusted_certificate_authority_ids")); ok {
719729
interfaces := trustedCertificateAuthorityIds.([]interface{})
720730
tmp := make([]string, len(interfaces))

website/docs/r/load_balancer_listener.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ resource "oci_load_balancer_listener" "test_listener" {
3838
ssl_configuration {
3939
#Optional
4040
certificate_name = oci_load_balancer_certificate.test_certificate.name
41+
has_session_resumption = var.listener_ssl_configuration_has_session_resumption
4142
certificate_ids = var.listener_ssl_configuration_certificate_ids
4243
cipher_suite_name = var.listener_ssl_configuration_cipher_suite_name
4344
protocols = var.listener_ssl_configuration_protocols
@@ -78,6 +79,7 @@ The following arguments are supported:
7879
**Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
7980
* `certificate_ids` - (Optional) (Updatable) Ids for Oracle Cloud Infrastructure certificates service certificates. Currently only a single Id may be passed. Example: `[ocid1.certificate.oc1.us-ashburn-1.amaaaaaaav3bgsaa5o2q7rh5nfmkkukfkogasqhk6af2opufhjlqg7m6jqzq]`
8081
* `certificate_name` - (Optional) (Updatable) A friendly name for the certificate bundle. It must be unique and it cannot be changed. Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. Certificate bundle names cannot contain spaces. Avoid entering confidential information. Example: `example_certificate_bundle`
82+
* `has_session_resumption` - (Optional) (Updatable) Whether the load balancer listener should resume an encrypted session by reusing the cryptographic parameters of a previous TLS session, without having to perform a full handshake again. If "true", the service resumes the previous TLS encrypted session. If "false", the service starts a new TLS encrypted session. Enabling session resumption improves performance but provides a lower level of security. Disabling session resumption improves security but reduces performance. Example: `true`
8183
* `cipher_suite_name` - (Optional) (Updatable) The name of the cipher suite to use for HTTPS or SSL connections.
8284

8385
If this field is not specified, the default is `oci-default-ssl-cipher-suite-v1`.

0 commit comments

Comments
 (0)