Hey everyone! I'm trying to run pulumi in lambda a...
# automation-api
l
Hey everyone! I'm trying to run pulumi in lambda and having a hard time. I keep getting the error:
Copy code
{
  "errorMessage": "\n code: 255\n stdout: Updating (dev):\n\npulumi:pulumi:Stack buildbot-shared-12345-dev running\npulumi:providers:aws default_4_15_0  error: no resource plugin 'aws-v4.15.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource aws v4.15.0`\npulumi:providers:aws default_4_15_0 **failed** 1 error\npulumi:pulumi:Stack buildbot-shared-12345-dev\n\nDiagnostics:\npulumi:providers:aws (default_4_15_0):\nerror: no resource plugin 'aws-v4.15.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource aws v4.15.0`\n\nResources:\n1 unchanged\n\nDuration: 3s\n\n stderr: warning: A new version of Pulumi is available. To upgrade from version '3.9.1' to '3.10.1', visit <https://pulumi.com/docs/reference/install/> for manual instructions and release notes.\n",
  "errorType": "CommandError",
  "stackTrace": [
    "  File \"/var/task/handler.py\", line 71, in launch_shared_stack\n    up_res = stack.up(on_output=print)\n",
    "  File \"/var/task/pulumi/automation/_stack.py\", line 262, in up\n    up_result = self._run_pulumi_cmd_sync(args, on_output)\n",
    "  File \"/var/task/pulumi/automation/_stack.py\", line 591, in _run_pulumi_cmd_sync\n    result = _run_pulumi_cmd(args, self.workspace.work_dir, envs, on_output)\n",
    "  File \"/var/task/pulumi/automation/_cmd.py\", line 75, in _run_pulumi_cmd\n    raise create_command_error(result)\n"
  ]
}
I've already created a layer with pulumi as an executable, and I've set
PULUMI_HOME
to
/tmp
but I'm still getting this error. Any ideas? I'm using python.
l
Inline programs require installing plugins before running the update.
l
I'm doing that actually already:
Copy code
def launch_shared_stack(event, context):
    project_name = f"buildbot-shared-{event['org_id']}"
    stack_name = "dev"
    print(stack_name)
    os.environ['PULUMI_CONFIG_PASSPHRASE'] = f'{project_name}{stack_name}'
    os.environ['PULUMI_HOME'] = '/tmp'
    project_settings = auto.ProjectSettings(
        name=project_name,
        runtime="python",
        backend=auto.ProjectBackend(url=f"<s3://pulumi-state-1234567899875f/shared>"))

    stack = auto.create_or_select_stack(stack_name=stack_name,
                                        project_name=project_name,
                                        program=sharedstack.handler,
                                        opts=auto.LocalWorkspaceOptions(project_settings=project_settings))
    print("successfully initialized stack")

    # for inline programs, we must manage plugins ourselves
    print("installing plugins...")
    stack.workspace.install_plugin("aws", "v4.15.0")
    print("plugins installed")

    # set stack configuration specifying the AWS region to deploy
    print("setting up config")

    # These will come from the event.
    stack.set_config("aws:region", auto.ConfigValue(value=event['region']))
    stack.set_config("repos", auto.ConfigValue(value=event['repos']))
    stack.set_config("org_id", auto.ConfigValue(value=event['org_id']))
    print("config set")
    print("refreshing stack...")
    stack.refresh(on_output=print)
    print("refresh complete")

    print("updating stack...")
    up_res = stack.up(on_output=print)
    print(f"Success!")

    stack.export_stack()
I've tried
v4.15.0
,
v4.0.0
, and
4.15.0
as the version. Nothing is working
Welp, actually it's suddently working so I'm not sure what was wrong but I don't need help anymore! 😂 Thank yoU!
👍 1