aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
236 stars 78 forks source link

Unable to add description to security group ingress/egress #96

Closed dcopestake closed 4 years ago

dcopestake commented 4 years ago

The ability to add descriptions to security group ingress/egress rules was added quite a while ago, and seems to be possible using the AWS CLI, but still doesn't seem possible via the PowerShell cmdlets as far as I can see?

Expected Behavior

I should be able to specify a Description property on Amazon.EC2.Model.IpPermission when using both Grant-EC2SecurityGroupIngress and Grant-EC2SecurityGroupEgress.

Current Behavior

It does not currently seem possible to specify a description when granting a rule.

matteo-prosperi commented 4 years ago

Hello, you should be able to specify a description for the Ipv4Ranges, Ipv6Ranges, PrefixListIds and UserIdGroupPairs. Updating Example 1 from the docs:

PS C:\> $ip1 = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; Ipv4Ranges=[Amazon.EC2.Model.IpRange]@{CidrIp="203.0.113.25/32"; Description='foo'} }
PS C:\> $ip2 = @{ IpProtocol="tcp"; FromPort="3389"; ToPort="3389"; Ipv4Ranges=[Amazon.EC2.Model.IpRange]@{CidrIp="203.0.113.25/32"; Description='bar'} }

PS C:\> Grant-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission @( $ip1, $ip2 )
dcopestake commented 4 years ago

Ah okay, thanks @matteo-prosperi, I was expecting the description to be at the root but didn't think to look further down.