From 69859a4ea9d14244fd739f495cedaea2d3d846d3 Mon Sep 17 00:00:00 2001 From: Thomas Kappler Date: Fri, 14 Jul 2023 12:02:56 +0200 Subject: [PATCH] Use provider object directly instead of wrapping it --- examples/callbackfunction/index.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/examples/callbackfunction/index.ts b/examples/callbackfunction/index.ts index d2acf34508d..6fa7b637cb6 100644 --- a/examples/callbackfunction/index.ts +++ b/examples/callbackfunction/index.ts @@ -16,11 +16,16 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; const config = new pulumi.Config("aws"); -const providerOpts = { provider: new aws.Provider("prov", { region: config.require("envRegion") }) }; +const provider = new aws.Provider("prov", { + region: config.require("envRegion") +}) +// const providerOpts = { +// provider: provider +// }; const role = new aws.iam.Role("role", { assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({ Service: "lambda.amazonaws.com" }), -}, providerOpts); +}, { provider }); const policy = new aws.iam.Policy("policy", { policy: { @@ -36,29 +41,29 @@ const policy = new aws.iam.Policy("policy", { const functions = [ new aws.lambda.CallbackFunction("a", { callback: async () => ({ success: true }), - }, providerOpts), + }, { provider }), new aws.lambda.CallbackFunction("b", { role: role, callback: async () => ({ success: true }), - }, providerOpts), + }, { provider }), new aws.lambda.CallbackFunction("c", { role: role.arn, callback: async () => ({ success: true }), - }, providerOpts), + }, { provider }), new aws.lambda.CallbackFunction("d", { policies: [aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole], callback: async () => ({ success: true }), - }, providerOpts), + }, { provider }), new aws.lambda.CallbackFunction("e", { callbackFactory: () => { const ret = { success: true }; return async () => ret; }, - }, providerOpts), - // new aws.lambda.CallbackFunction("f", { - // policies: { one: policy.arn }, - // callback: async () => ({ success: true }), - // }, providerOpts), + }, { provider }), + new aws.lambda.CallbackFunction("f", { + policies: { one: policy.arn }, + callback: async () => ({ success: true }), + }, { provider }), ]; export const arns = functions.map(f => f.arn);