1. Packages
  2. Scaleway
  3. API Docs
  4. account
  5. getProjects
Scaleway v1.29.0 published on Tuesday, May 27, 2025 by pulumiverse

scaleway.account.getProjects

Explore with Pulumi AI

scaleway logo
Scaleway v1.29.0 published on Tuesday, May 27, 2025 by pulumiverse

    The scaleway.account.getProjects data source is used to list all Scaleway projects in an Organization.

    Refer to the Organizations and Projects documentation and API documentation for more information.

    Retrieve a Scaleway Projects

    The following commands allow you to:

    • retrieve all Projects in an Organization
    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    
    // Get all Projects in an Organization
    const all = scaleway.account.getProjects({
        organizationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    
    # Get all Projects in an Organization
    all = scaleway.account.get_projects(organization_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/account"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get all Projects in an Organization
    		_, err := account.GetProjects(ctx, &account.GetProjectsArgs{
    			OrganizationId: pulumi.StringRef("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        // Get all Projects in an Organization
        var all = Scaleway.Account.GetProjects.Invoke(new()
        {
            OrganizationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.account.AccountFunctions;
    import com.pulumi.scaleway.account.inputs.GetProjectsArgs;
    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) {
            // Get all Projects in an Organization
            final var all = AccountFunctions.getProjects(GetProjectsArgs.builder()
                .organizationId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
                .build());
    
        }
    }
    
    variables:
      # Get all Projects in an Organization
      all:
        fn::invoke:
          function: scaleway:account:getProjects
          arguments:
            organizationId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    

    Example Usage

    Deploy an SSH key in all your organization’s projects

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    import * as scaleway from "@pulumiverse/scaleway";
    
    export = async () => {
        const all = await scaleway.account.getProjects({});
        const main: scaleway.account.SshKey[] = [];
        for (const range = {value: 0}; range.value < all.projects.length; range.value++) {
            main.push(new scaleway.account.SshKey(`main-${range.value}`, {
                name: "main",
                publicKey: publicKey,
                projectId: all.projects[range.value].id,
            }));
        }
    }
    
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway
    
    all = scaleway.account.get_projects()
    main = []
    for range in [{"value": i} for i in range(0, len(all.projects))]:
        main.append(scaleway.account.SshKey(f"main-{range['value']}",
            name="main",
            public_key=public_key,
            project_id=all.projects[range["value"]].id))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/account"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		all, err := account.GetProjects(ctx, &account.GetProjectsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		var main []*account.SshKey
    		for index := 0; index < int(len(all.Projects)); index++ {
    			key0 := index
    			val0 := index
    			__res, err := account.NewSshKey(ctx, fmt.Sprintf("main-%v", key0), &account.SshKeyArgs{
    				Name:      pulumi.String("main"),
    				PublicKey: pulumi.Any(publicKey),
    				ProjectId: all.Projects[val0].Id,
    			})
    			if err != nil {
    				return err
    			}
    			main = append(main, __res)
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(async() => 
    {
        var all = await Scaleway.Account.GetProjects.InvokeAsync();
    
        var main = new List<Scaleway.Account.SshKey>();
        for (var rangeIndex = 0; rangeIndex < all.Projects.Length; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            main.Add(new Scaleway.Account.SshKey($"main-{range.Value}", new()
            {
                Name = "main",
                PublicKey = publicKey,
                ProjectId = all.Projects[range.Value].Id,
            }));
        }
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.account.AccountFunctions;
    import com.pulumi.scaleway.account.inputs.GetProjectsArgs;
    import com.pulumi.scaleway.account.SshKey;
    import com.pulumi.scaleway.account.SshKeyArgs;
    import com.pulumi.codegen.internal.KeyedValue;
    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) {
            final var all = AccountFunctions.getProjects();
    
            for (var i = 0; i < all.applyValue(getProjectsResult -> getProjectsResult.projects()).length(); i++) {
                new SshKey("main-" + i, SshKeyArgs.builder()
                    .name("main")
                    .publicKey(publicKey)
                    .projectId(all.applyValue(getProjectsResult -> getProjectsResult.projects())[range.value()].id())
                    .build());
    
            
    }
        }
    }
    
    Coming soon!
    

    Using getProjects

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getProjects(args: GetProjectsArgs, opts?: InvokeOptions): Promise<GetProjectsResult>
    function getProjectsOutput(args: GetProjectsOutputArgs, opts?: InvokeOptions): Output<GetProjectsResult>
    def get_projects(organization_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetProjectsResult
    def get_projects_output(organization_id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetProjectsResult]
    func GetProjects(ctx *Context, args *GetProjectsArgs, opts ...InvokeOption) (*GetProjectsResult, error)
    func GetProjectsOutput(ctx *Context, args *GetProjectsOutputArgs, opts ...InvokeOption) GetProjectsResultOutput

    > Note: This function is named GetProjects in the Go SDK.

    public static class GetProjects 
    {
        public static Task<GetProjectsResult> InvokeAsync(GetProjectsArgs args, InvokeOptions? opts = null)
        public static Output<GetProjectsResult> Invoke(GetProjectsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetProjectsResult> getProjects(GetProjectsArgs args, InvokeOptions options)
    public static Output<GetProjectsResult> getProjects(GetProjectsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: scaleway:account/getProjects:getProjects
      arguments:
        # arguments dictionary

    The following arguments are supported:

    OrganizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    OrganizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    organizationId String
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    organizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    organization_id str
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    organizationId String
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource

    getProjects Result

    The following output properties are available:

    CreatedAt string
    (Computed) The date and time when the project was created.
    Description string
    (Computed) The description of the project.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    (Computed) The name of the project.
    OrganizationId string
    (Computed) The unique identifier of the organization with which the project is associated.
    Projects List<Pulumiverse.Scaleway.Account.Outputs.GetProjectsProject>
    (Computed) A list of projects. Each project has the following attributes:
    UpdatedAt string
    (Computed) The date and time when the project was updated.
    CreatedAt string
    (Computed) The date and time when the project was created.
    Description string
    (Computed) The description of the project.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    (Computed) The name of the project.
    OrganizationId string
    (Computed) The unique identifier of the organization with which the project is associated.
    Projects []GetProjectsProject
    (Computed) A list of projects. Each project has the following attributes:
    UpdatedAt string
    (Computed) The date and time when the project was updated.
    createdAt String
    (Computed) The date and time when the project was created.
    description String
    (Computed) The description of the project.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    (Computed) The name of the project.
    organizationId String
    (Computed) The unique identifier of the organization with which the project is associated.
    projects List<GetProjectsProject>
    (Computed) A list of projects. Each project has the following attributes:
    updatedAt String
    (Computed) The date and time when the project was updated.
    createdAt string
    (Computed) The date and time when the project was created.
    description string
    (Computed) The description of the project.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    (Computed) The name of the project.
    organizationId string
    (Computed) The unique identifier of the organization with which the project is associated.
    projects GetProjectsProject[]
    (Computed) A list of projects. Each project has the following attributes:
    updatedAt string
    (Computed) The date and time when the project was updated.
    created_at str
    (Computed) The date and time when the project was created.
    description str
    (Computed) The description of the project.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    (Computed) The name of the project.
    organization_id str
    (Computed) The unique identifier of the organization with which the project is associated.
    projects Sequence[GetProjectsProject]
    (Computed) A list of projects. Each project has the following attributes:
    updated_at str
    (Computed) The date and time when the project was updated.
    createdAt String
    (Computed) The date and time when the project was created.
    description String
    (Computed) The description of the project.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    (Computed) The name of the project.
    organizationId String
    (Computed) The unique identifier of the organization with which the project is associated.
    projects List<Property Map>
    (Computed) A list of projects. Each project has the following attributes:
    updatedAt String
    (Computed) The date and time when the project was updated.

    Supporting Types

    GetProjectsProject

    CreatedAt string
    (Computed) The date and time when the project was created.
    Description string
    (Computed) The description of the project.
    Id string
    (Computed) The unique identifier of the project.
    Name string
    (Computed) The name of the project.
    OrganizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    UpdatedAt string
    (Computed) The date and time when the project was updated.
    CreatedAt string
    (Computed) The date and time when the project was created.
    Description string
    (Computed) The description of the project.
    Id string
    (Computed) The unique identifier of the project.
    Name string
    (Computed) The name of the project.
    OrganizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    UpdatedAt string
    (Computed) The date and time when the project was updated.
    createdAt String
    (Computed) The date and time when the project was created.
    description String
    (Computed) The description of the project.
    id String
    (Computed) The unique identifier of the project.
    name String
    (Computed) The name of the project.
    organizationId String
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    updatedAt String
    (Computed) The date and time when the project was updated.
    createdAt string
    (Computed) The date and time when the project was created.
    description string
    (Computed) The description of the project.
    id string
    (Computed) The unique identifier of the project.
    name string
    (Computed) The name of the project.
    organizationId string
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    updatedAt string
    (Computed) The date and time when the project was updated.
    created_at str
    (Computed) The date and time when the project was created.
    description str
    (Computed) The description of the project.
    id str
    (Computed) The unique identifier of the project.
    name str
    (Computed) The name of the project.
    organization_id str
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    updated_at str
    (Computed) The date and time when the project was updated.
    createdAt String
    (Computed) The date and time when the project was created.
    description String
    (Computed) The description of the project.
    id String
    (Computed) The unique identifier of the project.
    name String
    (Computed) The name of the project.
    organizationId String
    The unique identifier of the Organization with which the Projects are associated. If no default organization_id is set, one must be set explicitly in this datasource
    updatedAt String
    (Computed) The date and time when the project was updated.

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.29.0 published on Tuesday, May 27, 2025 by pulumiverse