Hi - I'm wondering if the nodejs sdk is able to be...
# typescript
n
Hi - I'm wondering if the nodejs sdk is able to be used outside the CLI. I'm getting an error that says
Program run without the Pulumi engine available; re-run using the pulumi CLI
I have a slightly modified version of an example from the pulumi/aws repo
Copy code
// Copyright 2016-2017, Pulumi Corporation.  All rights reserved.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { Output } from "@pulumi/pulumi";
import { Region } from "@pulumi/aws";
//import { getLinuxAMI } from "./linuxAmi";

const config = new pulumi.Config("aws");
//const region = <aws.Region>config.require("envRegion");
const region: Region = "us-east-2";
const providerOpts = { provider: new aws.Provider("prov", { region }) };

let size = aws.ec2.InstanceTypes.T2_Micro;

let group = new aws.ec2.SecurityGroup("web-secgrp-2", {
    description: "Enable HTTP access",
    ingress: [
        { protocol: aws.ec2.TCPProtocol, fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] },
    ],
}, providerOpts);

let server = new aws.ec2.Instance("web-server-www", {
    instanceType: size,
    securityGroups: [ group.name ],
    ami: 'ami-0d03add87774b12c5',
}, providerOpts);

export let publicIp = server.publicIp;
export let publicDns = server.publicDns;
f
The CLI is required to run pulumi programs
w
For a little more detail on the architecture and why the CLI is required - see https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/.
n
Ok, then i will just look into directly invoking the pulumi CLI from my application. Thanks!
Just read through that doc. Totally understand now that your core commands, engine, persistence, etc are implemented in go. Just a little feedback, it would be nice if you exposed that functionality as a native library that could then be leveraged by the various SDKs. For example, commands like
pulumi up
could be invoked from a node application by calling something like
pulumiEngine.up(resourceArray)
. Obviously engine configuration would need to be exposed as well. But this would definitely be a useful feature