GoogleCloudPlatform / google-cloud-powershell

PowerShell cmdlets for the Google Cloud Platform
http://googlecloudplatform.github.io/google-cloud-powershell/
Apache License 2.0
136 stars 61 forks source link

How do I specify a port-range to to New-GceFirewallProtocol? #537

Closed SurferJeffAtGoogle closed 7 years ago

SurferJeffAtGoogle commented 7 years ago

For example:

New-GceFirewallProtocol tcp -Port 0..65535 | New-GceFirewallProtocol udp -Port 0..65535 | New-GceFirewallProtocol icmp | Add-GceFirewall all-internal -Network opsmgr -SourceRange 10.0.0.0/20

Fails with:

Add-GceFirewall : Google.Apis.Requests.RequestError
Invalid value for field 'resource.allowed[0].ports[0]': '0..65535'. Invalid port 
range specification. [400]
quoctruong commented 7 years ago

I believe it should be 0-65535 for a range.

chrsmith commented 7 years ago

Yes, it appears that it does require a dash:

https://github.com/GoogleCloudPlatform/google-cloud-powershell/blob/master/Google.PowerShell/Compute/GceFirewallProtocolCmdlet.cs#L54

However, we should keep this bug open for a few minor follow-ups:

(1) We should add an example to our docs to hopefully remove confusion in the future. (2) Maybe find/replace ".." to "-" in the port string just in case? (3) Searching for New-Gce-FirewallProtocol didn't have our docs come up. So obviously we have some SEO to do.

quoctruong commented 7 years ago

This is fixed with https://github.com/GoogleCloudPlatform/google-cloud-powershell/pull/540. It should be available in the next Cloud SDK release.