alicloud.ram.GroupMembership
Explore with Pulumi AI
Provides a RAM Group membership resource.
NOTE: Available since v1.0.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as std from "@pulumi/std";
const config = new pulumi.Config();
const name = config.get("name") || "tfexample";
const group = new alicloud.ram.Group("group", {
name: std.format({
input: "%sgroup",
args: [name],
}).then(invoke => invoke.result),
comments: "this is a group comments.",
});
const user = new alicloud.ram.User("user", {
name: std.format({
input: "%suser",
args: [name],
}).then(invoke => invoke.result),
displayName: "user_display_name",
mobile: "86-18688888888",
email: "hello.uuu@aaa.com",
comments: "yoyoyo",
});
const user1 = new alicloud.ram.User("user1", {
name: std.format({
input: "%suser1",
args: [name],
}).then(invoke => invoke.result),
displayName: "user_display_name1",
mobile: "86-18688888889",
email: "hello.uuu@aaa.com",
comments: "yoyoyo",
});
const membership = new alicloud.ram.GroupMembership("membership", {
groupName: group.name,
userNames: [
user.name,
user1.name,
],
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_std as std
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tfexample"
group = alicloud.ram.Group("group",
name=std.format(input="%sgroup",
args=[name]).result,
comments="this is a group comments.")
user = alicloud.ram.User("user",
name=std.format(input="%suser",
args=[name]).result,
display_name="user_display_name",
mobile="86-18688888888",
email="hello.uuu@aaa.com",
comments="yoyoyo")
user1 = alicloud.ram.User("user1",
name=std.format(input="%suser1",
args=[name]).result,
display_name="user_display_name1",
mobile="86-18688888889",
email="hello.uuu@aaa.com",
comments="yoyoyo")
membership = alicloud.ram.GroupMembership("membership",
group_name=group.name,
user_names=[
user.name,
user1.name,
])
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-std/sdk/go/std"
"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, "")
name := "tfexample"
if param := cfg.Get("name"); param != "" {
name = param
}
invokeFormat, err := std.Format(ctx, &std.FormatArgs{
Input: "%sgroup",
Args: []string{
name,
},
}, nil)
if err != nil {
return err
}
group, err := ram.NewGroup(ctx, "group", &ram.GroupArgs{
Name: pulumi.String(invokeFormat.Result),
Comments: pulumi.String("this is a group comments."),
})
if err != nil {
return err
}
invokeFormat1, err := std.Format(ctx, &std.FormatArgs{
Input: "%suser",
Args: []string{
name,
},
}, nil)
if err != nil {
return err
}
user, err := ram.NewUser(ctx, "user", &ram.UserArgs{
Name: pulumi.String(invokeFormat1.Result),
DisplayName: pulumi.String("user_display_name"),
Mobile: pulumi.String("86-18688888888"),
Email: pulumi.String("hello.uuu@aaa.com"),
Comments: pulumi.String("yoyoyo"),
})
if err != nil {
return err
}
invokeFormat2, err := std.Format(ctx, &std.FormatArgs{
Input: "%suser1",
Args: []string{
name,
},
}, nil)
if err != nil {
return err
}
user1, err := ram.NewUser(ctx, "user1", &ram.UserArgs{
Name: pulumi.String(invokeFormat2.Result),
DisplayName: pulumi.String("user_display_name1"),
Mobile: pulumi.String("86-18688888889"),
Email: pulumi.String("hello.uuu@aaa.com"),
Comments: pulumi.String("yoyoyo"),
})
if err != nil {
return err
}
_, err = ram.NewGroupMembership(ctx, "membership", &ram.GroupMembershipArgs{
GroupName: group.Name,
UserNames: pulumi.StringArray{
user.Name,
user1.Name,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tfexample";
var @group = new AliCloud.Ram.Group("group", new()
{
Name = Std.Format.Invoke(new()
{
Input = "%sgroup",
Args = new[]
{
name,
},
}).Apply(invoke => invoke.Result),
Comments = "this is a group comments.",
});
var user = new AliCloud.Ram.User("user", new()
{
Name = Std.Format.Invoke(new()
{
Input = "%suser",
Args = new[]
{
name,
},
}).Apply(invoke => invoke.Result),
DisplayName = "user_display_name",
Mobile = "86-18688888888",
Email = "hello.uuu@aaa.com",
Comments = "yoyoyo",
});
var user1 = new AliCloud.Ram.User("user1", new()
{
Name = Std.Format.Invoke(new()
{
Input = "%suser1",
Args = new[]
{
name,
},
}).Apply(invoke => invoke.Result),
DisplayName = "user_display_name1",
Mobile = "86-18688888889",
Email = "hello.uuu@aaa.com",
Comments = "yoyoyo",
});
var membership = new AliCloud.Ram.GroupMembership("membership", new()
{
GroupName = @group.Name,
UserNames = new[]
{
user.Name,
user1.Name,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ram.Group;
import com.pulumi.alicloud.ram.GroupArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FormatArgs;
import com.pulumi.alicloud.ram.User;
import com.pulumi.alicloud.ram.UserArgs;
import com.pulumi.alicloud.ram.GroupMembership;
import com.pulumi.alicloud.ram.GroupMembershipArgs;
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 name = config.get("name").orElse("tfexample");
var group = new Group("group", GroupArgs.builder()
.name(StdFunctions.format(FormatArgs.builder()
.input("%sgroup")
.args(name)
.build()).result())
.comments("this is a group comments.")
.build());
var user = new User("user", UserArgs.builder()
.name(StdFunctions.format(FormatArgs.builder()
.input("%suser")
.args(name)
.build()).result())
.displayName("user_display_name")
.mobile("86-18688888888")
.email("hello.uuu@aaa.com")
.comments("yoyoyo")
.build());
var user1 = new User("user1", UserArgs.builder()
.name(StdFunctions.format(FormatArgs.builder()
.input("%suser1")
.args(name)
.build()).result())
.displayName("user_display_name1")
.mobile("86-18688888889")
.email("hello.uuu@aaa.com")
.comments("yoyoyo")
.build());
var membership = new GroupMembership("membership", GroupMembershipArgs.builder()
.groupName(group.name())
.userNames(
user.name(),
user1.name())
.build());
}
}
configuration:
name:
type: string
default: tfexample
resources:
group:
type: alicloud:ram:Group
properties:
name:
fn::invoke:
function: std:format
arguments:
input: '%sgroup'
args:
- ${name}
return: result
comments: this is a group comments.
user:
type: alicloud:ram:User
properties:
name:
fn::invoke:
function: std:format
arguments:
input: '%suser'
args:
- ${name}
return: result
displayName: user_display_name
mobile: 86-18688888888
email: hello.uuu@aaa.com
comments: yoyoyo
user1:
type: alicloud:ram:User
properties:
name:
fn::invoke:
function: std:format
arguments:
input: '%suser1'
args:
- ${name}
return: result
displayName: user_display_name1
mobile: 86-18688888889
email: hello.uuu@aaa.com
comments: yoyoyo
membership:
type: alicloud:ram:GroupMembership
properties:
groupName: ${group.name}
userNames:
- ${user.name}
- ${user1.name}
Create GroupMembership Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupMembership(name: string, args: GroupMembershipArgs, opts?: CustomResourceOptions);
@overload
def GroupMembership(resource_name: str,
args: GroupMembershipArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupMembership(resource_name: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
user_names: Optional[Sequence[str]] = None)
func NewGroupMembership(ctx *Context, name string, args GroupMembershipArgs, opts ...ResourceOption) (*GroupMembership, error)
public GroupMembership(string name, GroupMembershipArgs args, CustomResourceOptions? opts = null)
public GroupMembership(String name, GroupMembershipArgs args)
public GroupMembership(String name, GroupMembershipArgs args, CustomResourceOptions options)
type: alicloud:ram:GroupMembership
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 GroupMembershipArgs
- 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 GroupMembershipArgs
- 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 GroupMembershipArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupMembershipArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupMembershipArgs
- 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 groupMembershipResource = new AliCloud.Ram.GroupMembership("groupMembershipResource", new()
{
GroupName = "string",
UserNames = new[]
{
"string",
},
});
example, err := ram.NewGroupMembership(ctx, "groupMembershipResource", &ram.GroupMembershipArgs{
GroupName: pulumi.String("string"),
UserNames: pulumi.StringArray{
pulumi.String("string"),
},
})
var groupMembershipResource = new GroupMembership("groupMembershipResource", GroupMembershipArgs.builder()
.groupName("string")
.userNames("string")
.build());
group_membership_resource = alicloud.ram.GroupMembership("groupMembershipResource",
group_name="string",
user_names=["string"])
const groupMembershipResource = new alicloud.ram.GroupMembership("groupMembershipResource", {
groupName: "string",
userNames: ["string"],
});
type: alicloud:ram:GroupMembership
properties:
groupName: string
userNames:
- string
GroupMembership 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 GroupMembership resource accepts the following input properties:
- Group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- User
Names List<string> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- Group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- User
Names []string - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name String - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names List<String> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names string[] - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group_
name str - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user_
names Sequence[str] - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name String - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names List<String> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
Outputs
All input properties are implicitly available as output properties. Additionally, the GroupMembership 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 GroupMembership Resource
Get an existing GroupMembership 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?: GroupMembershipState, opts?: CustomResourceOptions): GroupMembership
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
user_names: Optional[Sequence[str]] = None) -> GroupMembership
func GetGroupMembership(ctx *Context, name string, id IDInput, state *GroupMembershipState, opts ...ResourceOption) (*GroupMembership, error)
public static GroupMembership Get(string name, Input<string> id, GroupMembershipState? state, CustomResourceOptions? opts = null)
public static GroupMembership get(String name, Output<String> id, GroupMembershipState state, CustomResourceOptions options)
resources: _: type: alicloud:ram:GroupMembership 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.
- Group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- User
Names List<string> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- Group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- User
Names []string - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name String - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names List<String> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name string - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names string[] - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group_
name str - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user_
names Sequence[str] - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
- group
Name String - Name of the RAM group. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
- user
Names List<String> - Set of user name which will be added to group. Each name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen.
Import
RAM Group membership can be imported using the id, e.g.
$ pulumi import alicloud:ram/groupMembership:GroupMembership example my-group
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.