How obtain Team IDs?

I need team “IDs” for automating creation of db clusters using Pulumi. I do not have “Organization Owner” privileges? Is it possible for me to obtain the Team IDs, or do I need to contact an “Organization Owner”? How would they obtain these IDs?

I am following this Pulumi resource example from mongodbatlas.Project | Pulumi

import pulumi
import pulumi_mongodbatlas as mongodbatlas

test = mongodbatlas.Project("test",
    api_keys=[mongodbatlas.ProjectApiKeyArgs(
        api_key_id="61003b299dda8d54a9d7d10c",
        role_names=["GROUP_READ_ONLY"],
    )],
    org_id="<ORG_ID>",
    project_owner_id="<OWNER_ACCOUNT_ID>",
    teams=[
        mongodbatlas.ProjectTeamArgs(
            role_names=["GROUP_OWNER"],
            team_id="5e0fa8c99ccf641c722fe645",
        ),
        mongodbatlas.ProjectTeamArgs(
            role_names=[
                "GROUP_READ_ONLY",
                "GROUP_DATA_ACCESS_READ_WRITE",
            ],
            team_id="5e1dd7b4f2a30ba80a70cd4rw",
        ),
    ])

Hi @Aaron_Cutchin ,

There’s a few ways you can grab those team ids. The first is directly from the Atlas Admin API using curl. You can find a good example here that will get all team names and ids: https://www.mongodb.com/docs/atlas/reference/api/teams-get-all/

You can also use the Atlas CLI (brew install mongodb-atlas-cli) and use atlas teams list after logging in.

Also, I tested with an account where I only have Organization Project Creator and Organization Member and was able to get the team names and ids. So you don’t need “Organization Owner” for it.

Finally, while the Pulumi example has teams and even project_owner_id you don’t have to have them to just create a Project as those are optional parameters. Note a Project is an organizational structure to allow you to have settings across 1 or more clusters and hence has to be crated before the cluster. Hence this should work just as well but be a bit simpler:

test = mongodbatlas.Project("test",
    api_keys=[mongodbatlas.ProjectApiKeyArgs(
        api_key_id="61003b299dda8d54a9d7d10c",
        role_names=["GROUP_READ_ONLY"],
    )],
    org_id="<ORG_ID>"
)

Best,
Melissa

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.