alicloud.dataworks.ProjectMember
Explore with Pulumi AI
Provides a Data Works Project Member resource.
For information about Data Works Project Member and how to use it, see What is Project Member.
NOTE: Available since v1.237.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const adminCode = config.get("adminCode") || "role_project_admin";
const name = config.get("name") || "tf_example";
const randint = new random.index.Integer("randint", {
max: 999,
min: 1,
});
const defaultKCTrB2 = new alicloud.ram.User("defaultKCTrB2", {
displayName: `${name}${randint.id}`,
name: `${name}${randint.id}`,
});
const _default = alicloud.resourcemanager.getResourceGroups({});
const defaultQeRfvU = new alicloud.dataworks.Project("defaultQeRfvU", {
status: "Available",
description: "tf_desc",
projectName: `${name}${randint.id}`,
paiTaskEnabled: false,
displayName: "tf_new_api_display",
devRoleDisabled: true,
devEnvironmentEnabled: false,
resourceGroupId: _default.then(_default => _default.ids?.[0]),
});
const defaultProjectMember = new alicloud.dataworks.ProjectMember("default", {
userId: defaultKCTrB2.id,
projectId: defaultCoMnk8.id,
roles: [{
code: adminCode,
}],
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
admin_code = config.get("adminCode")
if admin_code is None:
admin_code = "role_project_admin"
name = config.get("name")
if name is None:
name = "tf_example"
randint = random.index.Integer("randint",
max=999,
min=1)
default_kc_tr_b2 = alicloud.ram.User("defaultKCTrB2",
display_name=f"{name}{randint['id']}",
name=f"{name}{randint['id']}")
default = alicloud.resourcemanager.get_resource_groups()
default_qe_rfv_u = alicloud.dataworks.Project("defaultQeRfvU",
status="Available",
description="tf_desc",
project_name=f"{name}{randint['id']}",
pai_task_enabled=False,
display_name="tf_new_api_display",
dev_role_disabled=True,
dev_environment_enabled=False,
resource_group_id=default.ids[0])
default_project_member = alicloud.dataworks.ProjectMember("default",
user_id=default_kc_tr_b2.id,
project_id=default_co_mnk8["id"],
roles=[{
"code": admin_code,
}])
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dataworks"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
adminCode := "role_project_admin"
if param := cfg.Get("adminCode"); param != "" {
adminCode = param
}
name := "tf_example"
if param := cfg.Get("name"); param != "" {
name = param
}
randint, err := random.NewInteger(ctx, "randint", &random.IntegerArgs{
Max: 999,
Min: 1,
})
if err != nil {
return err
}
defaultKCTrB2, err := ram.NewUser(ctx, "defaultKCTrB2", &ram.UserArgs{
DisplayName: pulumi.Sprintf("%v%v", name, randint.Id),
Name: pulumi.Sprintf("%v%v", name, randint.Id),
})
if err != nil {
return err
}
_default, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{}, nil)
if err != nil {
return err
}
_, err = dataworks.NewProject(ctx, "defaultQeRfvU", &dataworks.ProjectArgs{
Status: pulumi.String("Available"),
Description: pulumi.String("tf_desc"),
ProjectName: pulumi.Sprintf("%v%v", name, randint.Id),
PaiTaskEnabled: pulumi.Bool(false),
DisplayName: pulumi.String("tf_new_api_display"),
DevRoleDisabled: pulumi.Bool(true),
DevEnvironmentEnabled: pulumi.Bool(false),
ResourceGroupId: pulumi.String(_default.Ids[0]),
})
if err != nil {
return err
}
_, err = dataworks.NewProjectMember(ctx, "default", &dataworks.ProjectMemberArgs{
UserId: defaultKCTrB2.ID(),
ProjectId: pulumi.Any(defaultCoMnk8.Id),
Roles: dataworks.ProjectMemberRoleArray{
&dataworks.ProjectMemberRoleArgs{
Code: pulumi.String(adminCode),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var adminCode = config.Get("adminCode") ?? "role_project_admin";
var name = config.Get("name") ?? "tf_example";
var randint = new Random.Index.Integer("randint", new()
{
Max = 999,
Min = 1,
});
var defaultKCTrB2 = new AliCloud.Ram.User("defaultKCTrB2", new()
{
DisplayName = $"{name}{randint.Id}",
Name = $"{name}{randint.Id}",
});
var @default = AliCloud.ResourceManager.GetResourceGroups.Invoke();
var defaultQeRfvU = new AliCloud.DataWorks.Project("defaultQeRfvU", new()
{
Status = "Available",
Description = "tf_desc",
ProjectName = $"{name}{randint.Id}",
PaiTaskEnabled = false,
DisplayName = "tf_new_api_display",
DevRoleDisabled = true,
DevEnvironmentEnabled = false,
ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0])),
});
var defaultProjectMember = new AliCloud.DataWorks.ProjectMember("default", new()
{
UserId = defaultKCTrB2.Id,
ProjectId = defaultCoMnk8.Id,
Roles = new[]
{
new AliCloud.DataWorks.Inputs.ProjectMemberRoleArgs
{
Code = adminCode,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.ram.User;
import com.pulumi.alicloud.ram.UserArgs;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.dataworks.Project;
import com.pulumi.alicloud.dataworks.ProjectArgs;
import com.pulumi.alicloud.dataworks.ProjectMember;
import com.pulumi.alicloud.dataworks.ProjectMemberArgs;
import com.pulumi.alicloud.dataworks.inputs.ProjectMemberRoleArgs;
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 config = ctx.config();
final var adminCode = config.get("adminCode").orElse("role_project_admin");
final var name = config.get("name").orElse("tf_example");
var randint = new Integer("randint", IntegerArgs.builder()
.max(999)
.min(1)
.build());
var defaultKCTrB2 = new User("defaultKCTrB2", UserArgs.builder()
.displayName(String.format("%s%s", name,randint.id()))
.name(String.format("%s%s", name,randint.id()))
.build());
final var default = ResourcemanagerFunctions.getResourceGroups();
var defaultQeRfvU = new Project("defaultQeRfvU", ProjectArgs.builder()
.status("Available")
.description("tf_desc")
.projectName(String.format("%s%s", name,randint.id()))
.paiTaskEnabled("false")
.displayName("tf_new_api_display")
.devRoleDisabled("true")
.devEnvironmentEnabled("false")
.resourceGroupId(default_.ids()[0])
.build());
var defaultProjectMember = new ProjectMember("defaultProjectMember", ProjectMemberArgs.builder()
.userId(defaultKCTrB2.id())
.projectId(defaultCoMnk8.id())
.roles(ProjectMemberRoleArgs.builder()
.code(adminCode)
.build())
.build());
}
}
configuration:
adminCode:
type: string
default: role_project_admin
name:
type: string
default: tf_example
resources:
randint:
type: random:integer
properties:
max: 999
min: 1
defaultKCTrB2:
type: alicloud:ram:User
properties:
displayName: ${name}${randint.id}
name: ${name}${randint.id}
defaultQeRfvU:
type: alicloud:dataworks:Project
properties:
status: Available
description: tf_desc
projectName: ${name}${randint.id}
paiTaskEnabled: 'false'
displayName: tf_new_api_display
devRoleDisabled: 'true'
devEnvironmentEnabled: 'false'
resourceGroupId: ${default.ids[0]}
defaultProjectMember:
type: alicloud:dataworks:ProjectMember
name: default
properties:
userId: ${defaultKCTrB2.id}
projectId: ${defaultCoMnk8.id}
roles:
- code: ${adminCode}
variables:
default:
fn::invoke:
function: alicloud:resourcemanager:getResourceGroups
arguments: {}
Create ProjectMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectMember(name: string, args: ProjectMemberArgs, opts?: CustomResourceOptions);
@overload
def ProjectMember(resource_name: str,
args: ProjectMemberArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectMember(resource_name: str,
opts: Optional[ResourceOptions] = None,
project_id: Optional[int] = None,
user_id: Optional[str] = None,
roles: Optional[Sequence[ProjectMemberRoleArgs]] = None)
func NewProjectMember(ctx *Context, name string, args ProjectMemberArgs, opts ...ResourceOption) (*ProjectMember, error)
public ProjectMember(string name, ProjectMemberArgs args, CustomResourceOptions? opts = null)
public ProjectMember(String name, ProjectMemberArgs args)
public ProjectMember(String name, ProjectMemberArgs args, CustomResourceOptions options)
type: alicloud:dataworks:ProjectMember
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ProjectMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ProjectMemberArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ProjectMemberArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectMemberArgs
- 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 projectMemberResource = new AliCloud.DataWorks.ProjectMember("projectMemberResource", new()
{
ProjectId = 0,
UserId = "string",
Roles = new[]
{
new AliCloud.DataWorks.Inputs.ProjectMemberRoleArgs
{
Code = "string",
Name = "string",
Type = "string",
},
},
});
example, err := dataworks.NewProjectMember(ctx, "projectMemberResource", &dataworks.ProjectMemberArgs{
ProjectId: pulumi.Int(0),
UserId: pulumi.String("string"),
Roles: dataworks.ProjectMemberRoleArray{
&dataworks.ProjectMemberRoleArgs{
Code: pulumi.String("string"),
Name: pulumi.String("string"),
Type: pulumi.String("string"),
},
},
})
var projectMemberResource = new ProjectMember("projectMemberResource", ProjectMemberArgs.builder()
.projectId(0)
.userId("string")
.roles(ProjectMemberRoleArgs.builder()
.code("string")
.name("string")
.type("string")
.build())
.build());
project_member_resource = alicloud.dataworks.ProjectMember("projectMemberResource",
project_id=0,
user_id="string",
roles=[{
"code": "string",
"name": "string",
"type": "string",
}])
const projectMemberResource = new alicloud.dataworks.ProjectMember("projectMemberResource", {
projectId: 0,
userId: "string",
roles: [{
code: "string",
name: "string",
type: "string",
}],
});
type: alicloud:dataworks:ProjectMember
properties:
projectId: 0
roles:
- code: string
name: string
type: string
userId: string
ProjectMember 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 ProjectMember resource accepts the following input properties:
- Project
Id int - Project ID
- User
Id string - The user ID of the member.
- Roles
List<Pulumi.
Ali Cloud. Data Works. Inputs. Project Member Role> - List of roles owned by members. See
roles
below.
- Project
Id int - Project ID
- User
Id string - The user ID of the member.
- Roles
[]Project
Member Role Args - List of roles owned by members. See
roles
below.
- project
Id Integer - Project ID
- user
Id String - The user ID of the member.
- roles
List<Project
Member Role> - List of roles owned by members. See
roles
below.
- project
Id number - Project ID
- user
Id string - The user ID of the member.
- roles
Project
Member Role[] - List of roles owned by members. See
roles
below.
- project_
id int - Project ID
- user_
id str - The user ID of the member.
- roles
Sequence[Project
Member Role Args] - List of roles owned by members. See
roles
below.
- project
Id Number - Project ID
- user
Id String - The user ID of the member.
- roles List<Property Map>
- List of roles owned by members. See
roles
below.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectMember resource produces the following output properties:
Look up Existing ProjectMember Resource
Get an existing ProjectMember 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?: ProjectMemberState, opts?: CustomResourceOptions): ProjectMember
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
project_id: Optional[int] = None,
roles: Optional[Sequence[ProjectMemberRoleArgs]] = None,
status: Optional[str] = None,
user_id: Optional[str] = None) -> ProjectMember
func GetProjectMember(ctx *Context, name string, id IDInput, state *ProjectMemberState, opts ...ResourceOption) (*ProjectMember, error)
public static ProjectMember Get(string name, Input<string> id, ProjectMemberState? state, CustomResourceOptions? opts = null)
public static ProjectMember get(String name, Output<String> id, ProjectMemberState state, CustomResourceOptions options)
resources: _: type: alicloud:dataworks:ProjectMember get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Project
Id int - Project ID
- Roles
List<Pulumi.
Ali Cloud. Data Works. Inputs. Project Member Role> - List of roles owned by members. See
roles
below. - Status string
- The status of the user in project
- User
Id string - The user ID of the member.
- Project
Id int - Project ID
- Roles
[]Project
Member Role Args - List of roles owned by members. See
roles
below. - Status string
- The status of the user in project
- User
Id string - The user ID of the member.
- project
Id Integer - Project ID
- roles
List<Project
Member Role> - List of roles owned by members. See
roles
below. - status String
- The status of the user in project
- user
Id String - The user ID of the member.
- project
Id number - Project ID
- roles
Project
Member Role[] - List of roles owned by members. See
roles
below. - status string
- The status of the user in project
- user
Id string - The user ID of the member.
- project_
id int - Project ID
- roles
Sequence[Project
Member Role Args] - List of roles owned by members. See
roles
below. - status str
- The status of the user in project
- user_
id str - The user ID of the member.
- project
Id Number - Project ID
- roles List<Property Map>
- List of roles owned by members. See
roles
below. - status String
- The status of the user in project
- user
Id String - The user ID of the member.
Supporting Types
ProjectMemberRole, ProjectMemberRoleArgs
Import
Data Works Project Member can be imported using the id, e.g.
$ pulumi import alicloud:dataworks/projectMember:ProjectMember example <project_id>:<user_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.