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 #18

Closed roni-frantchi closed 3 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.

rddimon commented 3 years ago

Hey @roni-frantchi Could you please try the latest version of the plugin?

rddimon commented 3 years ago

Close it as it's already implemented in the latest version