saltstack/salt — pull request #14701 by colinbjohnson (2014-08-04 00:18:44+00:00)
Title: boto_asg now support use of security group names in launch configs

This pull request will allow the use of a security group names within the ```boto_asg``` state module when creating Auto Scaling Groups within a VPC.

Previous Behavior:
When given a state file that looks like the following:
```
Ensure gateway security group exists:
boto_asg.present:
- name: test-vpc
- availability_zones:
- us-east-1c
- us-east-1d
- min_size: 0
- max_size: 0
- desired_capacity: 0
- region: us-east-1
- vpc_zone_identifier:
- subnet-61b47516
- subnet-a042a1f9
- tags:
- key: 'Name'
value: 'test'
propagate_at_launch: true
- launch_config_name: test
- launch_config:
- image_id: ami-a427efcc
- security_groups:
- sg-c4b3cea1
- gateway
- test-2
```
The boto_asg state would fail to execute due to a boto failure - the security group names aren't allows by Amazon's API because they lack specificity. As an example, the group ```gateway``` could be in multiple VPCs or in EC2-Classic and EC2-VPC - resulting in a condition where the launch configuration could not be created.

New Behavior:
Behavior has been modified slightly to allow for use of security group names within a boto_asg.present State Definition. Description Below.
1. If one or more VPC Zone Identifiers are given in an Auto Scaling Group Configuration, the boto_asg state module will call ```boto_vpc.get_subnet_association``` (newly added module/function) to determine which VPC the Auto Scaling Group is associated with.
2. If associated with a VPC, the boto_asg module will determine if there are any security groups defined in the Auto Scaling Group's Launch Configuration. If there are Launch Configuration <-> Security Group associations, the boto_asg state module will convert all Security Group Names to Security Group IDs using ```boto_secgroup.get_group_id``` (newly added module/function).
3. The new Auto Scaling Group and Launch Configuration will be built.

Additional Changes:
1. Unit Testing for newly added ```boto_secgroup.get_group_id``` and ```boto_vpc.get_subnet_association``` modules and functions.