mongodbatlas logo
MongoDB Atlas v3.7.1, Mar 10 23

mongodbatlas.getProjects

mongodbatlas.getProjects describe all Projects. This represents projects that have been created.

NOTE: Groups and projects are synonymous terms. You may find groupId in the official documentation.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

return await Deployment.RunAsync(() => 
{
    var testRolesOrgId = Mongodbatlas.GetRolesOrgId.Invoke();

    var testProject = new Mongodbatlas.Project("testProject", new()
    {
        OrgId = testRolesOrgId.Apply(getRolesOrgIdResult => getRolesOrgIdResult.OrgId),
        Teams = new[]
        {
            new Mongodbatlas.Inputs.ProjectTeamArgs
            {
                TeamId = "5e0fa8c99ccf641c722fe645",
                RoleNames = new[]
                {
                    "GROUP_OWNER",
                },
            },
            new Mongodbatlas.Inputs.ProjectTeamArgs
            {
                TeamId = "5e1dd7b4f2a30ba80a70cd4rw",
                RoleNames = new[]
                {
                    "GROUP_READ_ONLY",
                    "GROUP_DATA_ACCESS_READ_WRITE",
                },
            },
        },
        ApiKeys = new[]
        {
            new Mongodbatlas.Inputs.ProjectApiKeyArgs
            {
                ApiKeyId = "61003b299dda8d54a9d7d10c",
                RoleNames = new[]
                {
                    "GROUP_READ_ONLY",
                },
            },
        },
    });

    var testProjects = Mongodbatlas.GetProjects.Invoke(new()
    {
        PageNum = 1,
        ItemsPerPage = 5,
    });

});
package main

import (
	"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testRolesOrgId, err := mongodbatlas.GetRolesOrgId(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = mongodbatlas.NewProject(ctx, "testProject", &mongodbatlas.ProjectArgs{
			OrgId: *pulumi.String(testRolesOrgId.OrgId),
			Teams: mongodbatlas.ProjectTeamArray{
				&mongodbatlas.ProjectTeamArgs{
					TeamId: pulumi.String("5e0fa8c99ccf641c722fe645"),
					RoleNames: pulumi.StringArray{
						pulumi.String("GROUP_OWNER"),
					},
				},
				&mongodbatlas.ProjectTeamArgs{
					TeamId: pulumi.String("5e1dd7b4f2a30ba80a70cd4rw"),
					RoleNames: pulumi.StringArray{
						pulumi.String("GROUP_READ_ONLY"),
						pulumi.String("GROUP_DATA_ACCESS_READ_WRITE"),
					},
				},
			},
			ApiKeys: mongodbatlas.ProjectApiKeyTypeArray{
				&mongodbatlas.ProjectApiKeyTypeArgs{
					ApiKeyId: pulumi.String("61003b299dda8d54a9d7d10c"),
					RoleNames: pulumi.StringArray{
						pulumi.String("GROUP_READ_ONLY"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = mongodbatlas.LookupProjects(ctx, &mongodbatlas.LookupProjectsArgs{
			PageNum:      pulumi.IntRef(1),
			ItemsPerPage: pulumi.IntRef(5),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.Project;
import com.pulumi.mongodbatlas.ProjectArgs;
import com.pulumi.mongodbatlas.inputs.ProjectTeamArgs;
import com.pulumi.mongodbatlas.inputs.ProjectApiKeyArgs;
import com.pulumi.mongodbatlas.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) {
        final var testRolesOrgId = MongodbatlasFunctions.getRolesOrgId();

        var testProject = new Project("testProject", ProjectArgs.builder()        
            .orgId(testRolesOrgId.applyValue(getRolesOrgIdResult -> getRolesOrgIdResult.orgId()))
            .teams(            
                ProjectTeamArgs.builder()
                    .teamId("5e0fa8c99ccf641c722fe645")
                    .roleNames("GROUP_OWNER")
                    .build(),
                ProjectTeamArgs.builder()
                    .teamId("5e1dd7b4f2a30ba80a70cd4rw")
                    .roleNames(                    
                        "GROUP_READ_ONLY",
                        "GROUP_DATA_ACCESS_READ_WRITE")
                    .build())
            .apiKeys(ProjectApiKeyArgs.builder()
                .apiKeyId("61003b299dda8d54a9d7d10c")
                .roleNames("GROUP_READ_ONLY")
                .build())
            .build());

        final var testProjects = MongodbatlasFunctions.getProjects(GetProjectsArgs.builder()
            .pageNum(1)
            .itemsPerPage(5)
            .build());

    }
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_roles_org_id = mongodbatlas.get_roles_org_id()
test_project = mongodbatlas.Project("testProject",
    org_id=test_roles_org_id.org_id,
    teams=[
        mongodbatlas.ProjectTeamArgs(
            team_id="5e0fa8c99ccf641c722fe645",
            role_names=["GROUP_OWNER"],
        ),
        mongodbatlas.ProjectTeamArgs(
            team_id="5e1dd7b4f2a30ba80a70cd4rw",
            role_names=[
                "GROUP_READ_ONLY",
                "GROUP_DATA_ACCESS_READ_WRITE",
            ],
        ),
    ],
    api_keys=[mongodbatlas.ProjectApiKeyArgs(
        api_key_id="61003b299dda8d54a9d7d10c",
        role_names=["GROUP_READ_ONLY"],
    )])
test_projects = mongodbatlas.get_projects(page_num=1,
    items_per_page=5)
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const testRolesOrgId = mongodbatlas.getRolesOrgId({});
const testProject = new mongodbatlas.Project("testProject", {
    orgId: testRolesOrgId.then(testRolesOrgId => testRolesOrgId.orgId),
    teams: [
        {
            teamId: "5e0fa8c99ccf641c722fe645",
            roleNames: ["GROUP_OWNER"],
        },
        {
            teamId: "5e1dd7b4f2a30ba80a70cd4rw",
            roleNames: [
                "GROUP_READ_ONLY",
                "GROUP_DATA_ACCESS_READ_WRITE",
            ],
        },
    ],
    apiKeys: [{
        apiKeyId: "61003b299dda8d54a9d7d10c",
        roleNames: ["GROUP_READ_ONLY"],
    }],
});
const testProjects = mongodbatlas.getProjects({
    pageNum: 1,
    itemsPerPage: 5,
});
resources:
  testProject:
    type: mongodbatlas:Project
    properties:
      orgId: ${testRolesOrgId.orgId}
      teams:
        - teamId: 5e0fa8c99ccf641c722fe645
          roleNames:
            - GROUP_OWNER
        - teamId: 5e1dd7b4f2a30ba80a70cd4rw
          roleNames:
            - GROUP_READ_ONLY
            - GROUP_DATA_ACCESS_READ_WRITE
      apiKeys:
        - apiKeyId: 61003b299dda8d54a9d7d10c
          roleNames:
            - GROUP_READ_ONLY
variables:
  testRolesOrgId:
    fn::invoke:
      Function: mongodbatlas:getRolesOrgId
      Arguments: {}
  testProjects:
    fn::invoke:
      Function: mongodbatlas:getProjects
      Arguments:
        pageNum: 1
        itemsPerPage: 5

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(items_per_page: Optional[int] = None,
                 page_num: Optional[int] = None,
                 opts: Optional[InvokeOptions] = None) -> GetProjectsResult
def get_projects_output(items_per_page: Optional[pulumi.Input[int]] = None,
                 page_num: Optional[pulumi.Input[int]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetProjectsResult]
func LookupProjects(ctx *Context, args *LookupProjectsArgs, opts ...InvokeOption) (*LookupProjectsResult, error)
func LookupProjectsOutput(ctx *Context, args *LookupProjectsOutputArgs, opts ...InvokeOption) LookupProjectsResultOutput

> Note: This function is named LookupProjects 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: mongodbatlas:index/getProjects:getProjects
  arguments:
    # arguments dictionary

The following arguments are supported:

ItemsPerPage int

Number of items to return per page, up to a maximum of 500. Defaults to 100.

PageNum int

The page to return. Defaults to 1.

ItemsPerPage int

Number of items to return per page, up to a maximum of 500. Defaults to 100.

PageNum int

The page to return. Defaults to 1.

itemsPerPage Integer

Number of items to return per page, up to a maximum of 500. Defaults to 100.

pageNum Integer

The page to return. Defaults to 1.

itemsPerPage number

Number of items to return per page, up to a maximum of 500. Defaults to 100.

pageNum number

The page to return. Defaults to 1.

items_per_page int

Number of items to return per page, up to a maximum of 500. Defaults to 100.

page_num int

The page to return. Defaults to 1.

itemsPerPage Number

Number of items to return per page, up to a maximum of 500. Defaults to 100.

pageNum Number

The page to return. Defaults to 1.

getProjects Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Results List<GetProjectsResult>
TotalCount int
ItemsPerPage int
PageNum int
Id string

The provider-assigned unique ID for this managed resource.

Results []GetProjectsResult
TotalCount int
ItemsPerPage int
PageNum int
id String

The provider-assigned unique ID for this managed resource.

results List<GetProjectsResult>
totalCount Integer
itemsPerPage Integer
pageNum Integer
id string

The provider-assigned unique ID for this managed resource.

results GetProjectsResult[]
totalCount number
itemsPerPage number
pageNum number
id str

The provider-assigned unique ID for this managed resource.

results Sequence[GetProjectsResult]
total_count int
items_per_page int
page_num int
id String

The provider-assigned unique ID for this managed resource.

results List<Property Map>
totalCount Number
itemsPerPage Number
pageNum Number

Supporting Types

GetProjectsResult

ApiKeys List<GetProjectsResultApiKey>
ClusterCount int

The number of Atlas clusters deployed in the project.

Created string

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
Id string

Autogenerated Unique ID for this data source.

IsCollectDatabaseSpecificsStatisticsEnabled bool

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

IsDataExplorerEnabled bool

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

IsPerformanceAdvisorEnabled bool

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

IsRealtimePerformancePanelEnabled bool

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

IsSchemaAdvisorEnabled bool

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

Name string

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

OrgId string

The ID of the organization you want to create the project within.

RegionUsageRestrictions string

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

Teams List<GetProjectsResultTeam>
ApiKeys []GetProjectsResultApiKey
ClusterCount int

The number of Atlas clusters deployed in the project.

Created string

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
Id string

Autogenerated Unique ID for this data source.

IsCollectDatabaseSpecificsStatisticsEnabled bool

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

IsDataExplorerEnabled bool

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

IsPerformanceAdvisorEnabled bool

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

IsRealtimePerformancePanelEnabled bool

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

IsSchemaAdvisorEnabled bool

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

Name string

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

OrgId string

The ID of the organization you want to create the project within.

RegionUsageRestrictions string

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

Teams []GetProjectsResultTeam
apiKeys List<GetProjectsResultApiKey>
clusterCount Integer

The number of Atlas clusters deployed in the project.

created String

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
id String

Autogenerated Unique ID for this data source.

isCollectDatabaseSpecificsStatisticsEnabled Boolean

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

isDataExplorerEnabled Boolean

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

isPerformanceAdvisorEnabled Boolean

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

isRealtimePerformancePanelEnabled Boolean

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

isSchemaAdvisorEnabled Boolean

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

name String

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

orgId String

The ID of the organization you want to create the project within.

regionUsageRestrictions String

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

teams List<GetProjectsResultTeam>
apiKeys GetProjectsResultApiKey[]
clusterCount number

The number of Atlas clusters deployed in the project.

created string

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
id string

Autogenerated Unique ID for this data source.

isCollectDatabaseSpecificsStatisticsEnabled boolean

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

isDataExplorerEnabled boolean

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

isPerformanceAdvisorEnabled boolean

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

isRealtimePerformancePanelEnabled boolean

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

isSchemaAdvisorEnabled boolean

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

name string

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

orgId string

The ID of the organization you want to create the project within.

regionUsageRestrictions string

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

teams GetProjectsResultTeam[]
api_keys Sequence[GetProjectsResultApiKey]
cluster_count int

The number of Atlas clusters deployed in the project.

created str

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
id str

Autogenerated Unique ID for this data source.

is_collect_database_specifics_statistics_enabled bool

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

is_data_explorer_enabled bool

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

is_performance_advisor_enabled bool

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

is_realtime_performance_panel_enabled bool

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

is_schema_advisor_enabled bool

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

name str

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

org_id str

The ID of the organization you want to create the project within.

region_usage_restrictions str

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

teams Sequence[GetProjectsResultTeam]
apiKeys List<Property Map>
clusterCount Number

The number of Atlas clusters deployed in the project.

created String

The ISO-8601-formatted timestamp of when Atlas created the project.

  • teams.#.team_id - The unique identifier of the team you want to associate with the project. The team and project must share the same parent organization.
  • teams.#.role_names - Each string in the array represents a project role assigned to the team. Every user associated with the team inherits these roles. The following are valid roles:
id String

Autogenerated Unique ID for this data source.

isCollectDatabaseSpecificsStatisticsEnabled Boolean

Flag that indicates whether to enable statistics in cluster metrics collection for the project.

isDataExplorerEnabled Boolean

Flag that indicates whether to enable Data Explorer for the project. If enabled, you can query your database with an easy to use interface.

isPerformanceAdvisorEnabled Boolean

Flag that indicates whether to enable Performance Advisor and Profiler for the project. If enabled, you can analyze database logs to recommend performance improvements.

isRealtimePerformancePanelEnabled Boolean

Flag that indicates whether to enable Real Time Performance Panel for the project. If enabled, you can see real time metrics from your MongoDB database.

isSchemaAdvisorEnabled Boolean

Flag that indicates whether to enable Schema Advisor for the project. If enabled, you receive customized recommendations to optimize your data model and enhance performance. Disable this setting to disable schema suggestions in the Performance Advisor and the Data Explorer.

name String

The name of the project you want to create. (Cannot be changed via this Provider after creation.)

orgId String

The ID of the organization you want to create the project within.

regionUsageRestrictions String

If GOV_REGIONS_ONLY the project can be used for government regions only, otherwise defaults to standard regions. For more information see MongoDB Atlas for Government.

teams List<Property Map>

GetProjectsResultApiKey

ApiKeyId string
RoleNames List<string>
ApiKeyId string
RoleNames []string
apiKeyId String
roleNames List<String>
apiKeyId string
roleNames string[]
api_key_id str
role_names Sequence[str]
apiKeyId String
roleNames List<String>

GetProjectsResultTeam

RoleNames List<string>
TeamId string
RoleNames []string
TeamId string
roleNames List<String>
teamId String
roleNames string[]
teamId string
role_names Sequence[str]
team_id str
roleNames List<String>
teamId String

Package Details

Repository
MongoDB Atlas pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes

This Pulumi package is based on the mongodbatlas Terraform Provider.