Repository navigation
feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled - #5736
Conversation
…abled EnableHttpEndpoint and DisableHttpEndpoint answered UnsupportedOperation and DBCluster carried no HttpEndpointEnabled, so Terraform's enable_http_endpoint and CDK's enableDataApi never read back what they set. Clusters now record the flag and report it. The two actions take the cluster's ARN and raise ResourceNotFoundFault and InvalidResourceStateFault as the model lists them; CreateDBCluster, ModifyDBCluster and the AWS::RDS::DBCluster EnableHttpEndpoint property set it too. Turning it on is refused for engines other than Aurora PostgreSQL and Aurora MySQL. The Data API itself does not check the flag, so existing callers keep working. Closes floci-io#5732
PR Summary by QodoSupport RDS cluster Data API endpoint controls and status
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1.
|
| if (httpEndpoint != cluster.isHttpEndpointEnabled()) { | ||
| cluster = rdsService.setHttpEndpoint(region, cluster.getDbClusterIdentifier(), httpEndpoint); |
There was a problem hiding this comment.
2. A failed update leaves the endpoint changed 🐞 Bug ☼ Reliability
provisionDbCluster persists an in-place EnableHttpEndpoint change without recording its previous value for rollbackUpdate. If a later stack resource fails, rollback neither restores the flag nor redeploys the old template, and the stack enters UPDATE_ROLLBACK_FAILED with the cluster still in the failed update's state.
Agent Prompt
## Issue description
An in-place CloudFormation endpoint update survives a failed stack update and leaves rollback incomplete.
## Fix Focus Areas
- src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java[478-481]
- src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java[192-221]
## Recommended Fix
Record the prior endpoint flag before changing it, restore that flag in `rollbackUpdate` for in-place cluster updates, and clear the rollback record after a successful update. Add a stack-level test in which a later resource fails.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
pgermosen
left a comment
There was a problem hiding this comment.
@avison9 thanks, the shapes and errors match the EnableHttpEndpoint and DisableHttpEndpoint reference, and recording the flag without enforcing it in rds-data is a sensible line to draw.
One thing: clusterForResourceArn repeats what clusterIdentifierFromArnOrName in the same class already does, the ARN parse, the cluster: prefix and the region and account check, and only the error differs. Please pull that into one helper that both call, each throwing its own error.
clusterForResourceArn repeated the ARN parsing, cluster: prefix and account and Region check of clusterIdentifierFromArnOrName; both now call clusterIdFromArn, each raising the error its API documents. The Data API engine check takes aurora-postgresql, aurora-mysql and the older aurora name exactly instead of any name starting with aurora, and the AWS::RDS::DBCluster EnableHttpEndpoint property accepts true or false only, so a malformed value fails instead of turning the endpoint off.
|
Done in 3074d30. Two tightenings in the same commit:
|
pgermosen
left a comment
There was a problem hiding this comment.
@avison9 thanks, the shared ARN parser reads well, and making EnableHttpEndpoint strict was a good call.
One small thing left: drop the bare "aurora" from the Data API engine set. The API reference only lists aurora-mysql and aurora-postgresql, and resolveEngine already refuses the bare name for new clusters, so no cluster can carry it and the entry just makes the check look looser than it is. The engine test would then expect it to be refused.
Rolling the endpoint back on a failed stack update would be nice, but every in-place cluster property has the same gap today, so leave that for a separate PR on the provisioner.
The API reference lists those two engines, and new clusters cannot carry the bare aurora name, so the check no longer accepts it.
|
Done in 188f68d: |
pgermosen
left a comment
There was a problem hiding this comment.
Thanks @avison9, that closes the engine check. Good to go.
I tidied the description for the squash commit: dropped the run log and the test list, and put the first checklist line back to the template.
(follow-up, separate PR) A failed stack update still leaves EnableHttpEndpoint changed, the same as every other in-place DB cluster property (IAM auth, capacity, auto-pause, the master password). Fixing that needs a rollback design for the whole cluster resource, including how to restore a password without keeping it in the stack.
Summary
Closes #5732.
EnableHttpEndpointandDisableHttpEndpointansweredUnsupportedOperation, andDBClustercarried noHttpEndpointEnabled. A cluster always read as having the Data API off, whatever Terraform'senable_http_endpoint, CDK'senableDataApioraws rds enable-http-endpointhad asked for.aws --endpoint-url http://localhost:4566 rds enable-http-endpoint \ --resource-arn arn:aws:rds:us-east-1:000000000000:cluster:app # before: An error occurred (UnsupportedOperation) ... # after: {"ResourceArn": "arn:aws:rds:us-east-1:000000000000:cluster:app", "HttpEndpointEnabled": true}What changed:
DbCluster.httpEndpointEnabled, reported asHttpEndpointEnabledin everyDBClusterresponse. It defaults to off, so clusters persisted before this change load with it off.EnableHttpEndpoint/DisableHttpEndpointtake the cluster's ARN and returnResourceArnandHttpEndpointEnabled, with the errors the model lists:ResourceNotFoundFault(404) for an ARN that names no cluster in the caller's account and Region, including an instance ARN, another Region or account, or a malformed ARN;InvalidResourceStateFaultfor a cluster that is notavailable;MissingParameterwithoutResourceArn.CreateDBCluster/ModifyDBClusterEnableHttpEndpoint. A modify that leaves the parameter out leaves the flag as it is. TheAWS::RDS::DBClusterEnableHttpEndpointproperty sets it on create and on update (No interruption). A template that drops the property turns the endpoint off.InvalidParameterCombination, and a create or CloudFormation stack checks this before the cluster exists. Turning it off is always accepted.RDS_ACTIONS.docs/services/rds.md.rds-data.mdline that said the flag "is not modeled locally" now says it is recorded but not checked.docs/services/index.md, 98 to 100.Deliberately not in this PR:
rds-data. AWS refuses Data API calls to a cluster with the endpoint off. Doing that here would break every current Floci user who calls the Data API without enabling it, so the flag is recorded and reported only. Enforcement could follow behind a setting if wanted.ModifyDBCluster EnableHttpEndpointis accepted for any Aurora cluster, although AWS documents it for Aurora Serverless v1 only. Floci does not model Serverless v1 separately, and refusing would only break tools.Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Request and response shapes and errors follow the RDS API reference for
EnableHttpEndpoint,DisableHttpEndpointand theEnableHttpEndpointmember ofCreateDBCluster/ModifyDBCluster. The new SDK compatibility testRdsControlPlaneTest.sdkTogglesTheDataApiEndpointenables, describes and disables the endpoint through the AWS SDK for Java, and getsResourceNotFoundExceptionfor an unknown ARN.Checklist
./mvnw testpasses locally