
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
pulumi-repl
Advanced tools
Create cloud infrastructure and explore pulumi in an interactive NodeJS REPL.
apply
and experiment with other pulumi functionality.eject
!ctrl+c
.Just a few lines of code to get started:
import { PulumiRepl } from "pulumi-repl";
const repl = new PulumiRepl({
stack: "dev",
project: "pulumi-repl",
eject: true, // save my work at the end in ./eject
config: {
"aws:region": { value: "us-west-2" }
},
});
repl.start().catch(err => console.error(err));
Create kubernetes resources interactively! At the end, all created resources are saved in stae by the pulumi engine.
When you're done with your REPL, you can eject a pulumi program generated from all the commands you entered. Here we create a static S3 website. At the end our program is ejected in ./eject
. When we run a preview on that program, we see that there's no diff!
import { PulumiRepl } from "pulumi-repl";
// configure the REPL
const repl = new PulumiRepl({
stack: "dev", // you Pulumi stack name, where your infrastructure state gets stored
project: "pulumi-repl", // top level pulumi project
config: { // any config that might be required by your cloud provider
"aws:region": { value: "us-west-2" }
},
});
// start execution, ctrl+c to exit
repl.start().catch(err => console.error(err));
The REPL has a builtin function registerOutput(k, v)
which creates stack exports.
$ pulumi-repl> registerOutput("websiteUrl", siteBucket.websiteEndpoint);
...
Outputs:
websiteUrl: "s3-website-bucket-82db68d.s3-website-us-west-2.amazonaws.com"
eject
will output a full pulumi program into the ./eject
directory including:
const repl = new PulumiRepl({
eject: true // save your work in ./eject at the end
stack: "dev",
project: "pulumi-repl",
config: {
"aws:region": { value: "us-west-2" }
},
});
To run your program:
```sh
$ cd ./eject
$ yarn install
$ pulumi stack select # pick the stack you want to work with
$ pulumi config set ... # set any cloud provider config values if needed
$ pulumi preview # see your program in action
The REPL comes preloaded with the following Pulumi provider plugins:
You can add additional provider plugins and SDKs as described below.
The REPL supports defining context values via this.addContext(k, v)
, which we use to load the random
resource provider SDK below. In addition, we access the Automation API stack object to install plugins.
import { PulumiRepl } from "pulumi-repl";
// import a custom pulumi provider SDK.
import * as random from "@pulumi/random";
const repl = new PulumiRepl({
stack: "dev",
project: "pulumi-repl-custom",
});
// make the random SDK accessible to the repl at runtime
repl.addContext("random", random);
// access the automation api stack to install provider plugins
repl.stack.then(s => {
// install the 'random' resource provider plugin
s.workspace.installPlugin("random", "v4.0.0").then(()=>{
repl.start().catch(err => console.error(err));
})
});
Specify the ephemeral: true
arg to run the repl in ephemeral mode. On ctrl+c
all of your cloud resources will be cleaned up and destroyed.
import { PulumiRepl } from "pulumi-repl";
const repl = new PulumiRepl({
stack: "dev",
project: "pulumi-repl-custom",
ephemeral: true // delete the resources created during this session with ctrl+c
});
If you're an advanced Pulumi user, you may want to access the Automation API Stack. You can do this via this.stack
(a promise).
You can access the underlying LocalWorkspace
via this.stack.then(s => s.workspace)
.
Advanced workspace configuration options are available including custom backends (azure, filestate, etc), and custom secrets providers via ReplArgs.workspaceOpts
This library uses the native NodeJS REPL library and the Pulumi Automation API (OSS) which turns the Pulumi IaC engine into an embeddable SDK.
When you execute commands in the REPL, you're still running pulumi code. Because Pulumi is declarative and desired state, resources can't be mutated after they are instantiated in the REPL. You'll have to exit the session and restart to "make an edit". Each REPL session will compute differences against the previous state. If you define a resource in one session and then forget it in the next one, it will be deleted. This is just like making edits and running a normal pulumi program, the only difference is that we get to create resources incrementally and explore their shape, outputs, etc.
Read more about Pulumi's desired state architecture: https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/
FAQs
Import and run Pulumi in a REPL.
The npm package pulumi-repl receives a total of 1 weekly downloads. As such, pulumi-repl popularity was classified as not popular.
We found that pulumi-repl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.