Incorrect Java Code Example in Registry for aws.iam.GroupMembership resource
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
What happened?
I tried to deploy the Java example on this page and received the following error:
Example
Deploy the Java example on this page
Output of pulumi about
N/A
Additional context
The issue seems to be that we need to create a single output that is a List containing both outputs. Here is a version of this resource that works (courtesy of @cnunciato):
package myproject;
import com.pulumi.Pulumi;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.Group;
import com.pulumi.aws.iam.GroupArgs;
import com.pulumi.aws.iam.GroupPolicy;
import com.pulumi.aws.iam.GroupPolicyArgs;
import com.pulumi.aws.iam.GroupMembership;
import com.pulumi.aws.iam.GroupMembershipArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.core.Output;
import java.util.List;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var jane = new User("jane", UserArgs.builder().build());
var mary = new User("mary", UserArgs.builder().build());
// Create a single output from the two other outputs.
var userIds = Output.all(jane.id(), mary.id()).applyValue(ids -> List.of(ids.get(0), ids.get(1)));
// Define a group and assign a policy for it.
var devs = new Group("devs", GroupArgs.builder()
.path("/users/")
.build());
new GroupPolicy("my_developer_policy", GroupPolicyArgs.builder()
.group(devs.name())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Action", jsonArray("ec2:Describe*")),
jsonProperty("Effect", "Allow"),
jsonProperty("Resource", "*")
)))
)))
.build());
new GroupMembership("dev-team", GroupMembershipArgs.builder()
.group(devs.id())
.users(userIds)
.build());
});
}
}
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Java example on the linked GroupMembership registry page and compare it with the working example included in the issue. Update the example so the users argument receives one list output containing both user IDs, then deploy the example to confirm it works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, java
- Domain
- authorization, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100