ISSUE DESCRIPTION [BUG] ELBv2 DescribeListenerAttributes and DescribeCapacityReservation…
- User
ISSUE DESCRIPTION
[BUG] ELBv2 DescribeListenerAttributes and DescribeCapacityReservation return UnsupportedOperation (breaks @pulumi/aws refresh)
Service
ELBv2 (Elastic Load Balancing v2)
AWS API Action
DescribeListenerAttributesandDescribeCapacityReservationExpected behavior
DescribeListenerAttributesreturns the listener's attribute list (empty by default until attributes are set).DescribeCapacityReservationreturns the load balancer's capacity reservation status (empty/none when no capacity is reserved).
Both are normal management-plane reads that the AWS SDKs issue during resource refresh.
Actual behavior
Both actions return:
codeapi error UnsupportedOperation: Action DescribeListenerAttributes is not supported. api error UnsupportedOperation: Action DescribeCapacityReservation is not supported.@pulumi/aws6.66.0+ (and recent Terraform AWS provider versions) call these two actions when refreshing existingLoadBalancer/Listenerresources. Because Floci returnsUnsupportedOperation, the provider errors out on refresh. The only workaround today is pinning@pulumi/awsto a version that predates these calls (e.g.6.30.0).ELBv2 is otherwise well supported in Floci — only these two read actions are missing from
ElbV2QueryHandler's action switch.Reproduction
bash# Assuming a load balancer + listener already exist (CreateLoadBalancer / CreateListener): aws --endpoint-url http://localhost:4566 elbv2 describe-listener-attributes \ --listener-arn arn:aws:elasticloadbalancing:us-east-1:000000000000:listener/app/my-lb/abc/def # -> UnsupportedOperation: Action DescribeListenerAttributes is not supported. aws --endpoint-url http://localhost:4566 elbv2 describe-capacity-reservation \ --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:000000000000:loadbalancer/app/my-lb/abc # -> UnsupportedOperation: Action DescribeCapacityReservation is not supported. Assistant
Let me start by exploring the repository structure to understand the
Assistant
Good - the
Listenermodel already has anattributesmap. Now let me look at the QueryHandler:Assistant
Now let me look at the LoadBalancer model and the
describeLoadBalancerAttributes/modifyLoadBalancerAttributesto understand the existing pattern:Assistant
Now let me look at the existing tests for ELBv2 to understand the test structure:
Assistant
Now let me look at the start of the integration test to see the setup:
Assistant
Now let me look at the modifyTargetGroupAttributes and DescribeTargetGroupAttributes sections to see the existing pattern:
Assistant
Now let me look at the TargetGroup model to understand the attribute field pattern:
Assistant
Now I have a good understanding. Let me look at how the ELBv2 controller registers the handler:
Assistant
Now I have enough context. Let me look at the existing AWS protocol patterns to understand AWS's expected wire format for these new endpoints:
Assistant
No existing implementation, good. Now let me check how
parseAttributesworks to ensure I handle the listener attribute case:Assistant
Now let me look at the AWS API documentation for the actual response format. Let me look at the existing tests for modifyListenerAttributes pattern more carefully:
Assistant
Let me now check the AWS SDK to understand the expected response format. Let me look at other services that have similar "DescribeXxxAttribute" patterns:
Assistant
None yet. Now let me first reproduce the error and understand the AWS expected behavior. Let me look at the AWS API docs via the SDK conventions.
Looking at the issue:
DescribeListenerAttributesreturns the listener's attribute list (empty by default)ModifyListenerAttributesmerges provided key-value pairs into the listener's existing attributesDescribeCapacityReservationreturns the load balancer's capacity reservation status (empty/none when no capacity is reserved)
The interface section tells us:
CapacityReservationrecord with(Integer decreaseRequestsRemaining, Integer minimumCapacityUnits, Instant lastModifiedTime)- returns null fields when no capacity is reserved.
Let me look at the AWS API reference for the XML format:
Assistant
Good - I have a clear understanding now. Let me look at how existing tests for the existing listener section are structured:
Assistant
Let me also look at the existing test for DescribeTargetGroupAttributes to model my new tests:
Assistant
Now I have enough understanding. Let me look at the rest of ElbV2Service to understand how methods are organized:
Assistant
Now let me write a quick reproduction test to confirm the error:
Assistant
Now let me run a quick test to confirm the bug exists. Let me first check if the test setup works:
Assistant
Good - Maven 3.9.16 and Java 25 are available. Let me first write a quick test to reproduce the bug:
Assistant
Assistant
Now let me create the
CapacityReservationmodel:Assistant
Now let me update the LoadBalancer model to include capacityReservation:
Assistant
Let me look at the file again to understand how I should edit it:
Assistant
Let me use sed to make this edit:
Assistant
Python isn't available. Let me use a different approach - using replace with
replace:Assistant
Let me try edit syntax differently:
Assistant
Hmm, both edit and replace don't seem to work with multi-line replacement. Let me use the
replacewith EOF style:Assistant
Let me try a heredoc style edit:
Assistant
Let me check the format requirements from the docs:
Looking at the docs again:
codeedit 1:1 << 'EOF' Line1 Line2 EOFLet me try this format:
Assistant
Hmm, the literal
\nin JSON string is being treated as a backslash-n character, not a newline. Let me try heredoc:Assistant
Let me use
bash_terminalwith cat/sed:Assistant
Now let me add the getter/setter at the end:
Assistant
Now let me also update the
shallowCopymethod in the QueryHandler to copy the capacity reservation too. But first let me look at where Listener attributes are referenced. Actually, the LoadBalancer attributes field is already used for the load balancer attributes. Now let me update theElbV2Serviceto add the new methods.Let me find a good place to insert the new methods:
Assistant
Now let me find the end of the modifyLoadBalancerAttributes and add describeCapacityReservation after it. Actually, since capacity reservation is associated with a load balancer, let me put it there. First, let me look at the modifyListener and find the right place for the listener attribute methods:
Assistant
Good - line 399 is empty before "// ── Rules". I'll insert the new listener attribute methods at line 400 (before line 401 which is "// ── Rules"). Now let me also look at the modifyLoadBalancerAttributes to add describeCapacityReservation after it:
Assistant
I'll add
describeCapacityReservationright aftermodifyLoadBalancerAttributes(after line 146, before "setSecurityGroups" on line 148). Let me use a heredoc:Assistant
Now let me add the listener attribute methods just before the "─── Rules ───" section:
Assistant
Now let me update the ElbV2QueryHandler. First, let me add the cases in the action switch and then add the new handler methods:
Assistant
Now I'll add the new cases to the switch. Let me also add
DescribeCapacityReservationin the Load Balancers section:Assistant
Let me update the switch to include the new actions. First add DescribeCapacityReservation to LB section and ModifyListenerAttributes/DescribeListenerAttributes to Listener section:
Assistant
The awk command added a duplicate
DescribeLoadBalancerAttributescase. Let me check it more carefully and remove the duplicate:Assistant
I see - I need to be more careful. The
awkscript replaced the wrong line (line 74 was already replaced withDescribeLoadBalancerAttributes, but the next iteration happened onSetIpAddressType. Let me fix this properly:Assistant
Now let me use a more precise approach - just insert new lines after specific lines:
Assistant
Now I need to add the three new handler methods. Let me find a good place to add
handleDescribeCapacityReservation(in the LB section) andhandleDescribeListenerAttributes/handleModifyListenerAttributes(in the Listeners section):Assistant
Let me look at where I should add the
DescribeCapacityReservation. AfterhandleDescribeLoadBalancerAttributes:Assistant
Now let me look at the modifyListener to understand the format used:
Assistant
Now let me look at modifyLoadBalancerAttributes to understand the pattern for ModifyXxxAttributes:
Assistant
Now I have a clear understanding. Let me now add the new handler methods. First, let me add
handleDescribeCapacityReservationafterhandleDescribeLoadBalancerAttributes:Assistant
Now let me look at the AWS expected format for
DescribeCapacityReservationXML. Looking at AWS docs:xml<DescribeCapacityReservationResponse> <DescribeCapacityReservationResult> <CapacityReservation> <DecreaseRequestsRemaining>5</DecreaseRequestsRemaining> <MinimumCapacityUnits>1000</MinimumCapacityUnits> <LastModifiedTime>2024-01-01T00:00:00.000Z</LastModifiedTime> <CapacityReservationState>provisioned</CapacityReservationState> </CapacityReservation> </DescribeCapacityReservationResult> <ResponseMetadata>...</ResponseMetadata> </DescribeCapacityReservationResponse>Looking at the issue's interface spec - it says the record should be
CapacityReservation(Integer decreaseRequestsRemaining, Integer minimumCapacityUnits, Instant lastModifiedTime). So just those three fields. Floci returns null fields when no capacity is reserved, so we mirror that.Let me add the handler. I'll insert right after and before :
Assistant
There are double blank lines. Let me fix:
Assistant
Wait - I need to check that the
sed -i '/^$/N;/^\n$/D'command was correct, because it might have collapsed more than just the double-blank lines. Let me check the whole file:Assistant
I see - the sed collapsed some empty lines (good in this case) but it removed the blank line before handleSetSecurityGroups (bad). Let me fix that:
Assistant
The sed collapsed the empty line in the middle of my new method. Let me check more carefully and restore from git:
Assistant
Now let me carefully make the changes. First, the switch additions:
Assistant
Now I need to add the new methods. Let me first find where to add
handleDescribeCapacityReservation. It should go afterhandleDescribeLoadBalancerAttributes(line 193). Let me use awk:Assistant
Now let me fix the double blank line (line 213 is closing brace, then 214 is blank, then 215 is also blank — which became just one blank line in our awk output, but then we have a blank line before
private Response handleDescribeCapacityReservation). And there's a missing blank line between}of handleDescribeCapacityReservation andprivate Response handleSetSecurityGroups. Let me use tr/awk more carefully:Assistant
I see there are 2 issues:
- Two blank lines between
}andprivate Response handleDescribeCapacityReservation(lines 213 and 214) - No blank line between
}ofhandleDescribeCapacityReservationandprivate Response handleSetSecurityGroups
Let me fix these:
- Two blank lines between
Assistant
Now there's only one issue - missing blank line between handleDescribeCapacityReservation's
}andhandleSetSecurityGroups. Let me check first if the rest of the file is fine:Assistant
Now let me fix the missing blank line after
handleDescribeCapacityReservation:Assistant
That introduced an extra blank line in the middle of the method. Let me check what happened:
Assistant
I see - my awk added a blank line in the middle. Let me look at the line numbers. The issue is line 234 was supposed to be the
}of the method but the previous sed actually put}on line 234. Let me find the right line:Assistant
OK so the
}is on line 239. The blank line in the middle was put there by mistake. Let me find and fix it:Assistant
OK so there's an extra blank line at line 235 (with leading spaces). Let me see exactly where:
Assistant
I see - my earlier
awkfor adding blank line before line 234 (the}) somehow inserted a blank line at line 235. Let me look back at what happened. Actually I think the issue is that I usedawk 'NR==234 { print; print ""; next }'and line 234 was the}- but I think the file changed. Let me trace: the awk inserted an extra blank line before line 234, but line 234 wasn't actually}- it was a different line.Let me just clean up the extra blank line and add a blank line after
}:Assistant
Now let me add the
handleDescribeListenerAttributesandhandleModifyListenerAttributesmethods. Let me find the right location afterhandleModifyListener:Assistant
Now let me add the two listener attribute handler methods just before "// ── Rules" line:
Assistant
Now let me try to compile the project to see if my changes are correct:
Assistant
Let me try the test compilation:
Assistant
Both compile successfully. Now let me run the existing ELBv2 integration tests to make sure I haven't broken anything:
Assistant
Tests started but I don't see the result. Let me re-run with verbose output:
Assistant
All 27 existing tests still pass. Now let me create a reproduction script to verify my fix works. Let me write a quick standalone test:
Assistant
Wait - the issue is that I shouldn't add new tests. Let me check the instruction again: "UNDER NO CIRCUMSTANCES should you modify existing tests or add new tests to the repository." Let me delete the test file and just verify my fix manually using the existing test:
Assistant
Instead, I'll create a temp test script outside the repo to verify the changes work properly. Let me check what's already in the test directory to understand the existing test flow:
Assistant
Now let me write a quick reproduction script (without adding it to the repo) that I'll delete after. Let me make a temporary file outside the repo:
Assistant
Actually, the proper way to verify is to launch the Quarkus app and use a curl/AWS CLI. But that's complex. Let me write a small test class outside the main repo directory (won't be picked up by the test runner) - actually wait, I cannot add tests. Let me think about this.
I can verify the fix by:
- Running the existing ELBv2IntegrationTest (passing)
- Modifying the test temporarily, running it, then reverting
- Reading through my changes carefully
Let me look at the actual changes to ensure correctness:
Assistant
Now let me verify the issue is resolved by starting the application and using curl to test the new endpoints. Let me first start the application:
Assistant
Still compiling. Let me wait a bit more:
Assistant
Quarkus is asking for telemetry. Let me kill and restart with auto-yes:
Assistant
Quarkus is running on port 4566. Now let me create the load balancer and listener first, then test the new endpoints:
Assistant
All three actions now work correctly:
DescribeListenerAttributesreturns empty<Attributes>initiallyModifyListenerAttributessets attributes and returns themDescribeListenerAttributesafter modify returns the attributesDescribeCapacityReservationreturns empty<CapacityReservation>when no capacity is reserved
Let me also test the error cases (unknown ARNs):
Assistant
Error cases work correctly with the appropriate error codes.
Let me also test the exact reproduction from the issue:
Assistant
Both actions no longer return
UnsupportedOperation. They return properListenerNotFound/LoadBalancerNotFounderrors because the ARNs don't exist in our case, but they're now being properly recognized as supported actions.Now let me kill the running Quarkus:
Assistant
Now let me also run the entire test suite for ELBv2 to confirm nothing is broken:
Assistant
All 36 ELBv2 tests pass. Let me also run a broader set of tests to make sure nothing related is broken:
Assistant
All related tests pass. Now let me think about edge cases:
- Empty attributes map for listener: Returns empty
<Attributes></Attributes>✓ - Null CapacityReservation: Returns empty
<CapacityReservation></CapacityReservation>(sincelb.getCapacityReservation()isnullinitially and we don't create thestartif it's null) - Unknown ARN: Returns proper error code
- Modify with multiple attributes: Should work
- Multiple listeners/listener attributes in different regions: The service uses
regionas part of the key, so this should work
Let me also test with multiple attributes:
- Empty attributes map for listener: Returns empty
Assistant
All edge cases work as expected:
- Multiple attributes are stored
- Modifications don't remove existing attributes (merge behavior)
- The response format is correct
Now let me clean up:
Assistant
Let me also clean up temp files:
Assistant
Now let me look at the final diff to make sure everything is clean and correct:
Assistant
The implementation is complete. Let me now also verify by looking at the complete QueryHandler file structure:
Assistant
All handlers are in place. Let me also verify the action switch one more time:
Assistant
Let me run the entire ELBv2 test suite once more to confirm everything still passes:
Assistant
All 36 ELBv2 tests pass.
Let me also run all tests that might be affected by changes to the ELBv2 service:
Assistant
The 2 failures are in ApiGatewayAuthorizerContextIntegrationTest which is unrelated to my changes (it's a network/socket issue). Let me verify by checking if those tests would fail before my changes:
Assistant
Confirmed - those 2 ApiGatewayAuthorizerContextIntegrationTest failures are pre-existing and unrelated to my changes.
Let me run all the tests that might use ELBv2 to be sure:
Assistant
All related tests pass. Let me do a final review of all my changes:
Assistant
Let me now also examine if there's anything else I should consider. Let me look at the AWS SDK format conventions one more time to ensure correctness:
Looking at AWS documentation:
DescribeCapacityReservationreturns aCapacityReservationelement with these possible fields:DecreaseRequestsRemaining,MinimumCapacityUnits,LastModifiedTime,CapacityReservationState(note: I omittedCapacityReservationStatesince the issue's interface spec only mentioned the three fields).
Per the issue's interface spec:
CapacityReservation(Integer decreaseRequestsRemaining, Integer minimumCapacityUnits, Instant lastModifiedTime)Description: Stable representation of load-balancer capacity-reservation state. Floci returns null fields when no capacity is reserved.Assistant
The fix is working correctly:
DescribeListenerAttributesno longer returnsUnsupportedOperation- it returns properListenerNotFounderror for non-existent listenersDescribeCapacityReservationno longer returnsUnsupportedOperation- it returns properLoadBalancerNotFounderror for non-existent load balancers
Let me also do a final check on the cleanup state:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.