Hi, I am trying to list all of the projects availa...
# google-cloud
p
Hi, I am trying to list all of the projects available in an organization. The docs aren't exactly clear on that. Would the following get an output of each project? I see that it returns an Output<ProjectResult>, but I can't operate on it like in the docs. I need to use .apply to pass functions to work on it. Is this the correct approach? I need the project IDs for adding principals and roles for access from other projects.
Copy code
ProjectsFunctions.getProject(GetProjectArgs.builder()
            .filter("")
            .build());
I don't know if it is the right approach, but I used something like this to solve it. I just imported the project numbers from another stack using a stack reference:
Copy code
new StackReference("myOrg/myStack/dev")
        .output("projectNumber")
        .apply(value -> {
            createIamMember(value.toString(),ctx);
            return Output.of(value);
        });
new StackReference("myOrg/myStack/prod")
        .output("projectNumber")
        .apply(value -> {
            createIamMember(value.toString(),ctx);
            return Output.of(value);
        });