Role Args
Provides a RAM Role resource.
NOTE: When you want to destroy this resource forcefully(means remove all the relationships associated with it automatically and then destroy it) without set
force
withtrue
at beginning, you need addforce = true
to configuration file and runpulumi preview
, then you can delete resource forcefully. NOTE: Available since v1.0.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Create a new RAM Role.
const role = new alicloud.ram.Role("role", {
name: "terraform-example",
document: ` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`,
description: "this is a role test.",
});
import pulumi
import pulumi_alicloud as alicloud
# Create a new RAM Role.
role = alicloud.ram.Role("role",
name="terraform-example",
document=""" {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""",
description="this is a role test.")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
// Create a new RAM Role.
var role = new AliCloud.Ram.Role("role", new()
{
Name = "terraform-example",
Document = @" {
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Effect"": ""Allow"",
""Principal"": {
""Service"": [
""apigateway.aliyuncs.com"",
""ecs.aliyuncs.com""
]
}
}
],
""Version"": ""1""
}
",
Description = "this is a role test.",
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a new RAM Role.
_, err := ram.NewRole(ctx, "role", &ram.RoleArgs{
Name: pulumi.String("terraform-example"),
Document: pulumi.String(` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`),
Description: pulumi.String("this is a role test."),
})
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.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
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) {
// Create a new RAM Role.
var role = new Role("role", RoleArgs.builder()
.name("terraform-example")
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a role test.")
.build());
}
}
resources:
# Create a new RAM Role.
role:
type: alicloud:ram:Role
properties:
name: terraform-example
document: " {\n \"Statement\": [\n {\n \"Action\": \"sts:AssumeRole\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"Service\": [\n \"apigateway.aliyuncs.com\", \n \"ecs.aliyuncs.com\"\n ]\n }\n }\n ],\n \"Version\": \"1\"\n }\n"
description: this is a role test.
Import
RAM role can be imported using the id or name, e.g.
$ pulumi import alicloud:ram/role:Role example my-role
Properties
Description of the RAM role. This name can have a string of 1 to 1024 characters. NOTE: The description
supports modification since V1.144.0.
The maximum session duration of the RAM role. Valid values: 3600 to 43200. Unit: seconds. Default value: 3600. The default value is used if the parameter is not specified.
(It has been deprecated since version 1.49.0, and use field 'document' to replace.) List of ram users who can assume the RAM role. The format of each item in this list is acs:ram::${account_id}:root
or acs:ram::${account_id}:user/${user_name}
, such as acs:ram::1234567890000:root
and acs:ram::1234567890001:user/Mary
. The ${user_name}
is the name of a RAM user which must exists in the Alicloud account indicated by the ${account_id}
.
(It has been deprecated since version 1.49.0, and use field 'document' to replace.) List of services which can assume the RAM role. The format of each item in this list is ${service}.aliyuncs.com
or ${account_id}@${service}.aliyuncs.com
, such as ecs.aliyuncs.com
and 1234567890000@ots.aliyuncs.com
. The ${service}
can be ecs
, log
, apigateway
and so on, the ${account_id}
refers to someone's Alicloud account id.