11locals  {
22  enabled  =  . this . enabled 
33
4-   external_vpc_id   =  . vpc_id  !=  null  ?  { " ExternalVpcId" :  {}
5-   networking_stack  =  . networking_stack  !=  null  ?  { " NetworkingStack" :  {}
6-   subnet_ids        =  . subnet_ids  !=  null  ?  { " ExternalVpcSubnetIds" join (" ," . subnet_ids ) } :  {}
4+   external_vpc_id          =  . vpc_id  !=  null  ?  { " ExternalVpcId" :  {}
5+   networking_stack         =  . networking_stack  !=  null  ?  { " NetworkingStack" :  {}
6+   subnet_ids               =  concat (coalesce (var. public_subnet_ids , []), coalesce (var. private_subnet_ids , []))
7+   external_vpc_subnet_ids  =  length (local. subnet_ids ) >  0  ?  { " ExternalVpcSubnetIds" join (" ," . subnet_ids ) } :  {}
78  //  If var.security_group_id is provided, we use it. Otherwise, if we are using the external networking stack, we create one.
89  external_security_group_id  =  . security_group_id  !=  null  ?  { " ExternalVpcSecurityGroupId" :  {}
910  //  If var.security_group_id is not provided and we are using the external networking stack, we create one.
@@ -14,7 +15,7 @@ locals {
1415    }, var. parameters 
1516    , local. networking_stack 
1617    , local. external_vpc_id 
17-     , local. subnet_ids 
18+     , local. external_vpc_subnet_ids 
1819    , local. external_security_group_id 
1920    , local. created_security_group_id 
2021  )
@@ -70,7 +71,7 @@ module "iam_policy" {
7071  ]
7172}
7273
73- //  Typically when runs-on is installed, and we're using the embedded networking stack, we need a security group.  
74+ //  Typically when runs-on is installed, and we're using the embedded networking stack, we need a security group.
7475//  This is a batties included optional feature.
7576module  "security_group"  {
7677  source   =  " cloudposse/security-group/aws" 
0 commit comments