diff --git a/moto/elbv2/models.py b/moto/elbv2/models.py index 4b3cf67ea..a748103e9 100644 --- a/moto/elbv2/models.py +++ b/moto/elbv2/models.py @@ -576,6 +576,9 @@ class FakeLoadBalancer(CloudFormationModel): "access_logs.s3.enabled", "access_logs.s3.bucket", "access_logs.s3.prefix", + "connection_logs.s3.bucket", + "connection_logs.s3.enabled", + "connection_logs.s3.prefix", "deletion_protection.enabled", "idle_timeout.timeout_seconds", "ipv6.deny_all_igw_traffic", diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py index 2df73d292..8b50ab7bb 100644 --- a/moto/elbv2/responses.py +++ b/moto/elbv2/responses.py @@ -1578,40 +1578,6 @@ DESCRIBE_ATTRIBUTES_TEMPLATE = """ """ -MODIFY_ATTRIBUTES_TEMPLATE = """ - - {{ load_balancer.name }} - - - {{ attributes.access_log.enabled }} - {% if attributes.access_log.enabled %} - {{ attributes.access_log.s3_bucket_name }} - {{ attributes.access_log.s3_bucket_prefix }} - {{ attributes.access_log.emit_interval }} - {% endif %} - - - {{ attributes.connecting_settings.idle_timeout }} - - - {{ attributes.cross_zone_load_balancing.enabled }} - - - {% if attributes.connection_draining.enabled %} - true - {{ attributes.connection_draining.timeout }} - {% else %} - false - {% endif %} - - - - - {{ request_id }} - - -""" - CREATE_LOAD_BALANCER_POLICY_TEMPLATE = """ diff --git a/tests/test_elbv2/test_elbv2.py b/tests/test_elbv2/test_elbv2.py index cd933cb5a..4da6b059c 100644 --- a/tests/test_elbv2/test_elbv2.py +++ b/tests/test_elbv2/test_elbv2.py @@ -1291,6 +1291,28 @@ def test_modify_load_balancer_attributes_routing_http_drop_invalid_header_fields assert routing_http_drop_invalid_header_fields_enabled["Value"] == "false" +@mock_elbv2 +@mock_ec2 +def test_modify_load_balancer_attributes_connection_logs_s3(): + response, _, _, _, _, client = create_load_balancer() + arn = response["LoadBalancers"][0]["LoadBalancerArn"] + + client.modify_load_balancer_attributes( + LoadBalancerArn=arn, + Attributes=[ + {"Key": "connection_logs.s3.enabled", "Value": "true"}, + {"Key": "connection_logs.s3.bucket", "Value": "s3bucket"}, + {"Key": "connection_logs.s3.prefix", "Value": "test_prefix"}, + ], + ) + + response = client.describe_load_balancer_attributes(LoadBalancerArn=arn) + attrs = client.describe_load_balancer_attributes(LoadBalancerArn=arn)["Attributes"] + assert {"Key": "connection_logs.s3.enabled", "Value": "true"} in attrs + assert {"Key": "connection_logs.s3.bucket", "Value": "s3bucket"} in attrs + assert {"Key": "connection_logs.s3.prefix", "Value": "test_prefix"} in attrs + + @mock_elbv2 @mock_ec2 @mock_acm