Giter Club home page Giter Club logo

Comments (6)

tenjaa avatar tenjaa commented on June 12, 2024 1

I already got it working by hardcoding everything, so I can confirm it works without any issues.

Probably next weekend I will find some time to polish it and create a PR :)

from aws-lambda-power-tuning.

alexcasalboni avatar alexcasalboni commented on June 12, 2024

Hi @tenjaa 👋 thanks for sharing, I think this is a great feature request 🚀

We'll need to include a conditional VpcConfig in the Globals section of the SAM template (similar to what we already do for the optional PermissionsBoundary).

To do that, we also need a couple of new template Parameters (e.g. securityGroupIds and subnetIds).

It would look very similar to this:

Parameters:
  securityGroupIds:
    Type: List<AWS::EC2::SecurityGroup::Id>
    Default: ''
  subnetIds:
    Type: List<AWS::EC2::Subnet::Id>
    Default: ''

Conditions:
  UseSecurityGroupIds: !Not [!Equals [!Ref securityGroupIds, '']]
  UseSubnetIds: !Not [!Equals [!Ref subnetIds, '']]
  UseVPCConfig: !Or [!Ref UseSecurityGroupIds, !Ref UseSubnetIds]

Globals:
  VpcConfig: !If [UseVPCConfig, {
    SecurityGroupIds: !If [UseSecurityGroupIds, !Ref securityGroupIds, !Ref AWS::NoValue],
    SubnetIds: !If [UseSubnetIds, !Ref subnetIds, !Ref AWS::NoValue]
  }, !Ref AWS::NoValue]

I haven't tested this and it's still missing the IAM managed policy part, but it should be a good starting point to implement it.

Do you feel like giving this a try and opening a PR? If not, I should be able to work on it myself in the next 4-5 weeks.

from aws-lambda-power-tuning.

alexcasalboni avatar alexcasalboni commented on June 12, 2024

Awesome, that sounds great 🚀

Let me know if you get stuck and/or need help.

Eventually, I'll make sure this new feature is available in the Terraform modules too :)

from aws-lambda-power-tuning.

alexcasalboni avatar alexcasalboni commented on June 12, 2024

@tenjaa I managed to spend some time on this :) Please have a look at this PR: #169

from aws-lambda-power-tuning.

tenjaa avatar tenjaa commented on June 12, 2024

Solved in #169 :)

from aws-lambda-power-tuning.

alexcasalboni avatar alexcasalboni commented on June 12, 2024

Thanks, @tenjaa 🙏

from aws-lambda-power-tuning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.