aws_glue.CfnConnection: JDBC Connection does not work without optional `availability_zone` param
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
The `availability_zone` param is optional for `aws_glue.CfnConnection.PhysicalConnectionRequirementsProperty`. A Connection resource is successfully created without it. However, "Test Connection" in the AWS Console fails with a cryptic error: `InvalidInputException: Unable to resolve any valid connection`
I noticed the Connection would work if I saved it in the AWS Console without changes. There is no field for Availability Zone in the UI, but the parameter is present in the network request when a Connection is saved. Inspecting that network request was the only way I was able to narrow down the problem. "Test Connection" worked after I added this optional param in CDK.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
I would expect failure to create the resource if it's not valid, or the value to be set on behalf of the user as it is in the AWS console, or a more actionable error message in the AWS Console.
### Current Behavior
A nonfunctional resource is created without an obvious path to troubleshoot.
### Reproduction Steps
```
aws_glue.CfnConnection(
self,
"some_connection_id",
catalog_id="some_catalog_id",
connection_input=aws_glue.CfnConnection.ConnectionInputProperty(
name="some jdbc connection",
connection_type="JDBC",
connection_properties={
"JDBC_CONNECTION_URL": "jdbc:mysql://some-cluster.us-west-2.rds.amazonaws.com:3306/some_database",
"JDBC_ENFORCE_SSL": False,
"SECRET_ID": "some_secret_id",
},
physical_connection_requirements=aws_glue.CfnConnection.PhysicalConnectionRequirementsProperty(
availability_zone="us-west-2a", # <-- here
subnet_id="some_subnet_id",
security_group_id_list=["some_security_group_id"],
),
),
)
```
### Possible Solution
- CloudFormation fails to create an invalid Connection resource, or
- Make `availability_zone` required, or
- Populate the value on behalf of the user like the AWS Console does, or
- Mention this somewhere in the documentation/docstrings, or
- Provide a more actionable error message
### Additional Information/Context
_No response_
### CDK CLI Version
2.149.0 (build c8e5924)
### Framework Version
_No response_
### Node.js Version
18.15.0
### OS
macOS
### Language
Python
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the aws_glue.CfnConnection.PhysicalConnectionRequirementsProperty reproduction and compare behavior with and without availability_zone, using the AWS Console request as the reference. Determine whether the completed work should validate the missing value, populate it, document the requirement, or improve the error path, and verify the chosen behavior against the reported JDBC connection scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100