aws / aws/aws-tools-for-powershell
Get-EC2Subnet filter does not honour wildcards like '*' and '?'
- Dominant language
- C#
- Stars
- 298
- Forks
- 102
- Avg merge
- 7d 17m
- Merged PRs (30d)
- 2
Description
### Describe the bug
Cmdlet: Get-EC2Subnet
Parameter: -Filter
When the Name property of the -Filter parameter is 'subnet-id', the filtering behaviour does not honour wildcards like '*' and '?'.
For example:
`Get-EC2Subnet -Filter @{Name = 'subnet-id'; Values = '*'}`
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Expected Behavior
I expect the command in the example to return all Subnets.
### Current Behavior
Nothing is returned.
### Reproduction Steps
`Get-EC2Subnet -Filter @{Name = 'subnet-id'; Values = '*'}`
### Possible Solution
_No response_
### Additional Information/Context
This command will return all VPC.
`Get-EC2Vpc -Filter @{Name = 'vpc-id'; Values = '*'}`
This command will return all Internet Gateways.
`Get-EC2InternetGateway -Filter @{Name = 'internet-gateway-id'; Values = '*'}`
But - this command returns nothing.
`Get-EC2Subnet -Filter @{Name = 'subnet-id'; Values = '*'}`
### AWS Tools for PowerShell version used
Name Version
---- -------
AWS.Tools.EC2 5.0.45
### PowerShell version used
Name Value
---- -----
PSVersion 7.5.3
PSEdition Core
GitCommitId 7.5.3
OS Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:17 PDT 2025; root:xnu-11417.140.69~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
### Operating System and version
macOS Sequoia v15.6.1
Contributor guide
Research direction
Start at the Get-EC2Subnet entry point and trace how its -Filter parameter handles the subnet-id Name and wildcard Values. Compare that behavior with Get-EC2Vpc and Get-EC2InternetGateway using the examples in the issue, then verify that '*' and '?' return matching subnets, including all subnets for '*'.2024
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, powershell
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100