Only filter SG's on VPC if it's set. Only use VPC's and Subnets that are available
This commit is contained in:
parent
533967cb66
commit
23f62f221e
|
@ -53,6 +53,7 @@ func (s *StepNetworkInfo) Run(_ context.Context, state multistep.StateBag) multi
|
|||
if s.VpcId == "" && !s.VpcFilter.Empty() {
|
||||
params := &ec2.DescribeVpcsInput{}
|
||||
params.Filters = buildEc2Filters(s.VpcFilter.Filters)
|
||||
s.VpcFilter.Filters[aws.String("state")] = aws.String("available")
|
||||
|
||||
log.Printf("Using VPC Filters %v", params)
|
||||
|
||||
|
@ -78,6 +79,7 @@ func (s *StepNetworkInfo) Run(_ context.Context, state multistep.StateBag) multi
|
|||
// Subnet
|
||||
if s.SubnetId == "" && !s.SubnetFilter.Empty() {
|
||||
params := &ec2.DescribeSubnetsInput{}
|
||||
s.SubnetFilter.Filters[aws.String("state")] = aws.String("available")
|
||||
|
||||
if s.VpcId != "" {
|
||||
s.SubnetFilter.Filters[aws.String("vpc-id")] = &s.VpcId
|
||||
|
|
|
@ -50,14 +50,10 @@ func (s *StepSecurityGroup) Run(_ context.Context, state multistep.StateBag) mul
|
|||
if !s.SecurityGroupFilter.Empty() {
|
||||
|
||||
params := &ec2.DescribeSecurityGroupsInput{}
|
||||
params.Filters = buildEc2Filters(s.SecurityGroupFilter.Filters)
|
||||
vpcFilter := ec2.Filter{
|
||||
Name: aws.String("vpc-id"),
|
||||
Values: []*string{
|
||||
aws.String(vpcId),
|
||||
},
|
||||
if vpcId != "" {
|
||||
s.SecurityGroupFilter.Filters[aws.String("vpc-id")] = &vpcId
|
||||
}
|
||||
params.Filters = append(params.Filters, &vpcFilter)
|
||||
params.Filters = buildEc2Filters(s.SecurityGroupFilter.Filters)
|
||||
|
||||
log.Printf("Using SecurityGroup Filters %v", params)
|
||||
|
||||
|
|
Loading…
Reference in New Issue