amplify-education / serverless-vpc-discovery

Serverless plugin for discovering VPC / Subnet / Security Group configuration by name.
MIT License
38 stars 15 forks source link

Allow multiple resources with same name tag #17

Closed roni-frantchi closed 5 years ago

roni-frantchi commented 5 years ago

On our setup, we have several Subnets and Security Groups associated with our VPC.

The motivation is instead of having name our subnets differently and having to specify each of name in serverless.yml, we add a common label to them all such as private_rds to all of them, allowing our plugin setup to look like this:

custom:
  vpc:
    vpcName: 'whatever'
    subnetNames:
      - 'private_rds'
    securityGroupNames:
      - 'private_rds'

This will match all subnets\security groups who share that name.

To achieve that, the assertion that the plugin makes that the number of parameters must match exactly the number of subnets found for them must be changed to allow less parameters than resources found.
In less resources than parameters are found, the plugin will fail as it used to.

roni-frantchi commented 5 years ago

Moved to #18 so we can merge from env0:multiple-resources-same-tag instead of env0:master