Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Improvements-1957.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component: sdk
kind: Improvements
body: Add support for the builtin Stash resource
time: 2025-12-12T13:24:29.609174Z
custom:
PR: "1957"
1 change: 0 additions & 1 deletion pkg/cmd/pulumi-language-java/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ var expectedFailures = map[string]string{
"l2-invoke-scalar": "exception at runtime",
"l3-component-simple": "compilation error",
"l1-builtin-cwd": "test failing",
"l1-builtin-stash": "test failing",
"l1-stack-reference": "test failing",
"l2-invoke-options": "test failing",
"l1-output-map": "test failing",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: l1-builtin-stash
runtime: java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.pulumi</groupId>
<artifactId>l1-builtin-stash</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<encoding>UTF-8</encoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<mainClass>generated_program.App</mainClass>
<mainArgs/>
</properties>

<repositories>
<repository>
<id>repository-0</id>
<url>REPOSITORY</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.pulumi</groupId>
<artifactId>pulumi</artifactId>
<version>CORE.VERSION</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mainClass>${mainClass}</mainClass>
<commandlineArgs>${mainArgs}</commandlineArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-wrapper-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<mavenVersion>3.8.5</mavenVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pulumi.Stash;
import com.pulumi.pulumi.StashArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}

public static void stack(Context ctx) {
var myStash = new Stash("myStash", StashArgs.builder()
.input(Map.ofEntries(
Map.entry("key",
"value",
"s"),
Map.entry("", false)
))
.build());

ctx.export("stashInput", myStash.input());
ctx.export("stashOutput", myStash.output());
}
}
75 changes: 75 additions & 0 deletions sdk/java/pulumi/src/main/java/com/pulumi/resources/Stash.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.pulumi.resources;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.internal.Internal;
import com.pulumi.core.internal.Maps;
import com.pulumi.core.internal.OutputData;
import com.pulumi.core.internal.annotations.InternalUse;
import com.pulumi.exceptions.RunException;

import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
* Stash stores an arbitrary value in the state.
*/
public class Stash extends CustomResource {

@Export(name = "output", refs = {Object.class})
private Output<Object> output;

@Export(name = "input", refs = {Object.class})
private Output<Object> input;

/**
* Create a {@link Stash} resource with the given unique name, arguments.
*
* @param name The unique name of the stash resource.
* @param args The arguments to use to populate this resource's properties.
* @see Stash#Stash(String, StashArgs, CustomResourceOptions)
*/
public Stash(String name, StashArgs args) {
this(name, args, CustomResourceOptions.Empty);
}

/**
* Create a {@link Stash} resource with the given unique name, arguments, and options.
*
* @param name The unique name of the stash resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public Stash(String name, @Nullable StashArgs args, @Nullable CustomResourceOptions options) {
super(
"pulumi:index:Stash",
name,
args,
options
);
}

/**
* The value saved in the state for the stash.
*
* @return the output value
*/
public Output<Object> output() {
return output;
}

/**
* The most recent value passed to the stash resource.
*
* @return the input value
*/
public Output<Object> input() {
return input;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.pulumi.resources;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;

import javax.annotation.Nullable;

/**
* The set of arguments for constructing a {@link Stash} resource.
*/
public final class StashArgs extends ResourceArgs {

/**
* An empty {@link StashArgs} instance.
*/
public static final StashArgs Empty = StashArgs.builder().build();

@Import(name = "output", required = true)
@Nullable
private final Output<Object> input;

public StashArgs(@Nullable Output<Object> input) {
this.input = input;
}

/**
* The value to store in the stash resource.
*/
public Output<Object> input() {
return input;
}

/**
* @return a {@link Builder} instance
*/
public static Builder builder() {
return new Builder();
}

/**
* The builder for {@link StackReferenceArgs}.
*/
public static final class Builder {
@Nullable
private Output<Object> input;

/**
* @param input the value to store in the stash resource.
* @return the {@link Builder}
* @see StashArgs#input()
*/
public Builder input(@Nullable Output<Object> input) {
this.input = input;
return this;
}

/**
* @param input the value to store in the stash resource.
* @return the {@link Builder}
* @see StashArgs#input()
*/
public Builder input(Object input) {
this.input = Output.of(input);
return this;
}

/**
* @return a {@link StashArgs} instance created from this {@link Builder}
*/
public StashArgs build() {
return new StashArgs(this.input);
}
}
}
Loading