1. Packages
  2. Prefect Provider
  3. API Docs
  4. TeamAccess
prefect 2.25.0 published on Monday, Apr 21, 2025 by prefecthq

prefect.TeamAccess

Explore with Pulumi AI

The resource team_access grants access to a team for a user or service account. For more information, see manage teams.

This feature is available in the following product plan(s): Prefect OSS, Prefect Cloud (Free), Prefect Cloud (Pro), Prefect Cloud (Enterprise).

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as prefect from "@pulumi/prefect";

// Example: granting access to a service account.
const testServiceAccount = new prefect.ServiceAccount("testServiceAccount", {});
const testTeam = new prefect.Team("testTeam", {description: "test-team-description"});
const testTeamAccess = new prefect.TeamAccess("testTeamAccess", {
    memberType: "service_account",
    memberId: testServiceAccount.id,
    memberActorId: testServiceAccount.actorId,
    teamId: testTeam.id,
});
// Example: granting access to a user.
const testAccountMember = prefect.getAccountMember({
    email: "marvin@prefect.io",
});
const testIndex_teamTeam = new prefect.Team("testIndex/teamTeam", {description: "test-team-description"});
const testIndex_teamAccessTeamAccess = new prefect.TeamAccess("testIndex/teamAccessTeamAccess", {
    teamId: testTeam.id,
    memberType: "user",
    memberId: testAccountMember.then(testAccountMember => testAccountMember.userId),
    memberActorId: testAccountMember.then(testAccountMember => testAccountMember.actorId),
});
Copy
import pulumi
import pulumi_prefect as prefect

# Example: granting access to a service account.
test_service_account = prefect.ServiceAccount("testServiceAccount")
test_team = prefect.Team("testTeam", description="test-team-description")
test_team_access = prefect.TeamAccess("testTeamAccess",
    member_type="service_account",
    member_id=test_service_account.id,
    member_actor_id=test_service_account.actor_id,
    team_id=test_team.id)
# Example: granting access to a user.
test_account_member = prefect.get_account_member(email="marvin@prefect.io")
test_index_team_team = prefect.Team("testIndex/teamTeam", description="test-team-description")
test_index_team_access_team_access = prefect.TeamAccess("testIndex/teamAccessTeamAccess",
    team_id=test_team.id,
    member_type="user",
    member_id=test_account_member.user_id,
    member_actor_id=test_account_member.actor_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/prefect/v2/prefect"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Example: granting access to a service account.
		testServiceAccount, err := prefect.NewServiceAccount(ctx, "testServiceAccount", nil)
		if err != nil {
			return err
		}
		testTeam, err := prefect.NewTeam(ctx, "testTeam", &prefect.TeamArgs{
			Description: pulumi.String("test-team-description"),
		})
		if err != nil {
			return err
		}
		_, err = prefect.NewTeamAccess(ctx, "testTeamAccess", &prefect.TeamAccessArgs{
			MemberType:    pulumi.String("service_account"),
			MemberId:      testServiceAccount.ID(),
			MemberActorId: testServiceAccount.ActorId,
			TeamId:        testTeam.ID(),
		})
		if err != nil {
			return err
		}
		testAccountMember, err := prefect.LookupAccountMember(ctx, &prefect.LookupAccountMemberArgs{
			Email: "marvin@prefect.io",
		}, nil)
		if err != nil {
			return err
		}
		_, err = prefect.NewTeam(ctx, "testIndex/teamTeam", &prefect.TeamArgs{
			Description: pulumi.String("test-team-description"),
		})
		if err != nil {
			return err
		}
		_, err = prefect.NewTeamAccess(ctx, "testIndex/teamAccessTeamAccess", &prefect.TeamAccessArgs{
			TeamId:        testTeam.ID(),
			MemberType:    pulumi.String("user"),
			MemberId:      pulumi.String(testAccountMember.UserId),
			MemberActorId: pulumi.String(testAccountMember.ActorId),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Prefect = Pulumi.Prefect;

return await Deployment.RunAsync(() => 
{
    // Example: granting access to a service account.
    var testServiceAccount = new Prefect.ServiceAccount("testServiceAccount");

    var testTeam = new Prefect.Team("testTeam", new()
    {
        Description = "test-team-description",
    });

    var testTeamAccess = new Prefect.TeamAccess("testTeamAccess", new()
    {
        MemberType = "service_account",
        MemberId = testServiceAccount.Id,
        MemberActorId = testServiceAccount.ActorId,
        TeamId = testTeam.Id,
    });

    // Example: granting access to a user.
    var testAccountMember = Prefect.GetAccountMember.Invoke(new()
    {
        Email = "marvin@prefect.io",
    });

    var testIndex_teamTeam = new Prefect.Team("testIndex/teamTeam", new()
    {
        Description = "test-team-description",
    });

    var testIndex_teamAccessTeamAccess = new Prefect.TeamAccess("testIndex/teamAccessTeamAccess", new()
    {
        TeamId = testTeam.Id,
        MemberType = "user",
        MemberId = testAccountMember.Apply(getAccountMemberResult => getAccountMemberResult.UserId),
        MemberActorId = testAccountMember.Apply(getAccountMemberResult => getAccountMemberResult.ActorId),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.prefect.ServiceAccount;
import com.pulumi.prefect.Team;
import com.pulumi.prefect.TeamArgs;
import com.pulumi.prefect.TeamAccess;
import com.pulumi.prefect.TeamAccessArgs;
import com.pulumi.prefect.PrefectFunctions;
import com.pulumi.prefect.inputs.GetAccountMemberArgs;
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) {
        // Example: granting access to a service account.
        var testServiceAccount = new ServiceAccount("testServiceAccount");

        var testTeam = new Team("testTeam", TeamArgs.builder()
            .description("test-team-description")
            .build());

        var testTeamAccess = new TeamAccess("testTeamAccess", TeamAccessArgs.builder()
            .memberType("service_account")
            .memberId(testServiceAccount.id())
            .memberActorId(testServiceAccount.actorId())
            .teamId(testTeam.id())
            .build());

        // Example: granting access to a user.
        final var testAccountMember = PrefectFunctions.getAccountMember(GetAccountMemberArgs.builder()
            .email("marvin@prefect.io")
            .build());

        var testIndex_teamTeam = new Team("testIndex/teamTeam", TeamArgs.builder()
            .description("test-team-description")
            .build());

        var testIndex_teamAccessTeamAccess = new TeamAccess("testIndex/teamAccessTeamAccess", TeamAccessArgs.builder()
            .teamId(testTeam.id())
            .memberType("user")
            .memberId(testAccountMember.applyValue(getAccountMemberResult -> getAccountMemberResult.userId()))
            .memberActorId(testAccountMember.applyValue(getAccountMemberResult -> getAccountMemberResult.actorId()))
            .build());

    }
}
Copy
resources:
  # Example: granting access to a service account.
  testServiceAccount:
    type: prefect:ServiceAccount
  testTeam:
    type: prefect:Team
    properties:
      description: test-team-description
  testTeamAccess: # Example: granting access to a user.
    type: prefect:TeamAccess
    properties:
      memberType: service_account
      memberId: ${testServiceAccount.id}
      memberActorId: ${testServiceAccount.actorId}
      teamId: ${testTeam.id}
  testIndex/teamTeam:
    type: prefect:Team
    properties:
      description: test-team-description
  testIndex/teamAccessTeamAccess:
    type: prefect:TeamAccess
    properties:
      teamId: ${testTeam.id}
      memberType: user
      memberId: ${testAccountMember.userId}
      memberActorId: ${testAccountMember.actorId}
variables:
  testAccountMember:
    fn::invoke:
      function: prefect:getAccountMember
      arguments:
        email: marvin@prefect.io
Copy

Create TeamAccess Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new TeamAccess(name: string, args: TeamAccessArgs, opts?: CustomResourceOptions);
@overload
def TeamAccess(resource_name: str,
               args: TeamAccessArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def TeamAccess(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               member_actor_id: Optional[str] = None,
               member_id: Optional[str] = None,
               member_type: Optional[str] = None,
               team_id: Optional[str] = None,
               account_id: Optional[str] = None)
func NewTeamAccess(ctx *Context, name string, args TeamAccessArgs, opts ...ResourceOption) (*TeamAccess, error)
public TeamAccess(string name, TeamAccessArgs args, CustomResourceOptions? opts = null)
public TeamAccess(String name, TeamAccessArgs args)
public TeamAccess(String name, TeamAccessArgs args, CustomResourceOptions options)
type: prefect:TeamAccess
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TeamAccessArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TeamAccessArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TeamAccessArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TeamAccessArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TeamAccessArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var teamAccessResource = new Prefect.TeamAccess("teamAccessResource", new()
{
    MemberActorId = "string",
    MemberId = "string",
    MemberType = "string",
    TeamId = "string",
    AccountId = "string",
});
Copy
example, err := prefect.NewTeamAccess(ctx, "teamAccessResource", &prefect.TeamAccessArgs{
	MemberActorId: pulumi.String("string"),
	MemberId:      pulumi.String("string"),
	MemberType:    pulumi.String("string"),
	TeamId:        pulumi.String("string"),
	AccountId:     pulumi.String("string"),
})
Copy
var teamAccessResource = new TeamAccess("teamAccessResource", TeamAccessArgs.builder()
    .memberActorId("string")
    .memberId("string")
    .memberType("string")
    .teamId("string")
    .accountId("string")
    .build());
Copy
team_access_resource = prefect.TeamAccess("teamAccessResource",
    member_actor_id="string",
    member_id="string",
    member_type="string",
    team_id="string",
    account_id="string")
Copy
const teamAccessResource = new prefect.TeamAccess("teamAccessResource", {
    memberActorId: "string",
    memberId: "string",
    memberType: "string",
    teamId: "string",
    accountId: "string",
});
Copy
type: prefect:TeamAccess
properties:
    accountId: string
    memberActorId: string
    memberId: string
    memberType: string
    teamId: string
Copy

TeamAccess Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The TeamAccess resource accepts the following input properties:

MemberActorId This property is required. string
Member Actor ID (UUID)
MemberId This property is required. string
Member ID (UUID)
MemberType This property is required. string
Member Type (user | service_account)
TeamId This property is required. string
Team ID (UUID)
AccountId string
Account ID (UUID)
MemberActorId This property is required. string
Member Actor ID (UUID)
MemberId This property is required. string
Member ID (UUID)
MemberType This property is required. string
Member Type (user | service_account)
TeamId This property is required. string
Team ID (UUID)
AccountId string
Account ID (UUID)
memberActorId This property is required. String
Member Actor ID (UUID)
memberId This property is required. String
Member ID (UUID)
memberType This property is required. String
Member Type (user | service_account)
teamId This property is required. String
Team ID (UUID)
accountId String
Account ID (UUID)
memberActorId This property is required. string
Member Actor ID (UUID)
memberId This property is required. string
Member ID (UUID)
memberType This property is required. string
Member Type (user | service_account)
teamId This property is required. string
Team ID (UUID)
accountId string
Account ID (UUID)
member_actor_id This property is required. str
Member Actor ID (UUID)
member_id This property is required. str
Member ID (UUID)
member_type This property is required. str
Member Type (user | service_account)
team_id This property is required. str
Team ID (UUID)
account_id str
Account ID (UUID)
memberActorId This property is required. String
Member Actor ID (UUID)
memberId This property is required. String
Member ID (UUID)
memberType This property is required. String
Member Type (user | service_account)
teamId This property is required. String
Team ID (UUID)
accountId String
Account ID (UUID)

Outputs

All input properties are implicitly available as output properties. Additionally, the TeamAccess resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing TeamAccess Resource

Get an existing TeamAccess resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: TeamAccessState, opts?: CustomResourceOptions): TeamAccess
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        member_actor_id: Optional[str] = None,
        member_id: Optional[str] = None,
        member_type: Optional[str] = None,
        team_id: Optional[str] = None) -> TeamAccess
func GetTeamAccess(ctx *Context, name string, id IDInput, state *TeamAccessState, opts ...ResourceOption) (*TeamAccess, error)
public static TeamAccess Get(string name, Input<string> id, TeamAccessState? state, CustomResourceOptions? opts = null)
public static TeamAccess get(String name, Output<String> id, TeamAccessState state, CustomResourceOptions options)
resources:  _:    type: prefect:TeamAccess    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
Account ID (UUID)
MemberActorId string
Member Actor ID (UUID)
MemberId string
Member ID (UUID)
MemberType string
Member Type (user | service_account)
TeamId string
Team ID (UUID)
AccountId string
Account ID (UUID)
MemberActorId string
Member Actor ID (UUID)
MemberId string
Member ID (UUID)
MemberType string
Member Type (user | service_account)
TeamId string
Team ID (UUID)
accountId String
Account ID (UUID)
memberActorId String
Member Actor ID (UUID)
memberId String
Member ID (UUID)
memberType String
Member Type (user | service_account)
teamId String
Team ID (UUID)
accountId string
Account ID (UUID)
memberActorId string
Member Actor ID (UUID)
memberId string
Member ID (UUID)
memberType string
Member Type (user | service_account)
teamId string
Team ID (UUID)
account_id str
Account ID (UUID)
member_actor_id str
Member Actor ID (UUID)
member_id str
Member ID (UUID)
member_type str
Member Type (user | service_account)
team_id str
Team ID (UUID)
accountId String
Account ID (UUID)
memberActorId String
Member Actor ID (UUID)
memberId String
Member ID (UUID)
memberType String
Member Type (user | service_account)
teamId String
Team ID (UUID)

Package Details

Repository
prefect prefecthq/terraform-provider-prefect
License
Notes
This Pulumi package is based on the prefect Terraform Provider.