Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda function examples should not have explicit names #3682

Closed
VenelinMartinov opened this issue Mar 22, 2024 · 1 comment
Closed

Lambda function examples should not have explicit names #3682

VenelinMartinov opened this issue Mar 22, 2024 · 1 comment
Assignees
Labels
area/examples impact/accessibility Something that is difficult or impossible for some people to use kind/enhancement Improvements or new features resolution/duplicate This issue is a duplicate of another issue

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Mar 22, 2024

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Related to pulumi/pulumi-terraform-bridge#1783

The basic example for lambda function has explicit name parameters: https://www.pulumi.com/registry/packages/aws/api-docs/lambda/function/#basic-example

This hurts code reuse and causes name clashes etc. It is also unnecessary since pulumi has auto-naming.

const iamForLambda = new aws.iam.Role("iam_for_lambda", {
    name: "iam_for_lambda",
    assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});

can be

const iamForLambda = new aws.iam.Role("iam_for_lambda", {
    assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});

and

const testLambda = new aws.lambda.Function("test_lambda", {
    code: new pulumi.asset.FileArchive("lambda_function_payload.zip"),
    name: "lambda_function_name",
    role: iamForLambda.arn,
    handler: "index.test",
    sourceCodeHash: lambda.then(lambda => lambda.outputBase64sha256),
    runtime: "nodejs18.x",
    environment: {
        variables: {
            foo: "bar",
        },
    },
});

can be

const testLambda = new aws.lambda.Function("test_lambda", {
    code: new pulumi.asset.FileArchive("lambda_function_payload.zip"),
    role: iamForLambda.arn,
    handler: "index.test",
    sourceCodeHash: lambda.then(lambda => lambda.outputBase64sha256),
    runtime: "nodejs18.x",
    environment: {
        variables: {
            foo: "bar",
        },
    },
});

Affected area/feature

@VenelinMartinov VenelinMartinov added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Mar 22, 2024
@t0yv0 t0yv0 added area/examples impact/cost Something that is causing unneeded expense impact/accessibility Something that is difficult or impossible for some people to use and removed needs-triage Needs attention from the triage team impact/cost Something that is causing unneeded expense labels Mar 25, 2024
@t0yv0
Copy link
Member

t0yv0 commented Apr 23, 2024

I think this is exactly pulumi/pulumi-converter-terraform#122

@t0yv0 t0yv0 added the resolution/duplicate This issue is a duplicate of another issue label Apr 23, 2024
@t0yv0 t0yv0 closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/examples impact/accessibility Something that is difficult or impossible for some people to use kind/enhancement Improvements or new features resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants