volcengine.iam.Role
Explore with Pulumi AI
Provides a resource to manage iam role
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";
const foo = new volcengine.iam.Role("foo", {
    description: "acc-test",
    displayName: "acc-test",
    maxSessionDuration: 3600,
    roleName: "acc-test-role",
    trustPolicyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
});
import pulumi
import pulumi_volcengine as volcengine
foo = volcengine.iam.Role("foo",
    description="acc-test",
    display_name="acc-test",
    max_session_duration=3600,
    role_name="acc-test-role",
    trust_policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
package main
import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/iam"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewRole(ctx, "foo", &iam.RoleArgs{
			Description:         pulumi.String("acc-test"),
			DisplayName:         pulumi.String("acc-test"),
			MaxSessionDuration:  pulumi.Int(3600),
			RoleName:            pulumi.String("acc-test-role"),
			TrustPolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() => 
{
    var foo = new Volcengine.Iam.Role("foo", new()
    {
        Description = "acc-test",
        DisplayName = "acc-test",
        MaxSessionDuration = 3600,
        RoleName = "acc-test-role",
        TrustPolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.iam.Role;
import com.pulumi.volcengine.iam.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) {
        var foo = new Role("foo", RoleArgs.builder()        
            .description("acc-test")
            .displayName("acc-test")
            .maxSessionDuration(3600)
            .roleName("acc-test-role")
            .trustPolicyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"sts:AssumeRole\"],\"Principal\":{\"Service\":[\"auto_scaling\"]}}]}")
            .build());
    }
}
resources:
  foo:
    type: volcengine:iam:Role
    properties:
      description: acc-test
      displayName: acc-test
      maxSessionDuration: 3600
      roleName: acc-test-role
      trustPolicyDocument: '{"Statement":[{"Effect":"Allow","Action":["sts:AssumeRole"],"Principal":{"Service":["auto_scaling"]}}]}'
Create Role Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);@overload
def Role(resource_name: str,
         args: RoleArgs,
         opts: Optional[ResourceOptions] = None)
@overload
def Role(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         display_name: Optional[str] = None,
         role_name: Optional[str] = None,
         trust_policy_document: Optional[str] = None,
         description: Optional[str] = None,
         max_session_duration: Optional[int] = None)func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)type: volcengine:iam:Role
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 RoleArgs
- 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 RoleArgs
- 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 RoleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RoleArgs
- 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 roleResource = new Volcengine.Iam.Role("roleResource", new()
{
    DisplayName = "string",
    RoleName = "string",
    TrustPolicyDocument = "string",
    Description = "string",
    MaxSessionDuration = 0,
});
example, err := iam.NewRole(ctx, "roleResource", &iam.RoleArgs{
	DisplayName:         pulumi.String("string"),
	RoleName:            pulumi.String("string"),
	TrustPolicyDocument: pulumi.String("string"),
	Description:         pulumi.String("string"),
	MaxSessionDuration:  pulumi.Int(0),
})
var roleResource = new Role("roleResource", RoleArgs.builder()
    .displayName("string")
    .roleName("string")
    .trustPolicyDocument("string")
    .description("string")
    .maxSessionDuration(0)
    .build());
role_resource = volcengine.iam.Role("roleResource",
    display_name="string",
    role_name="string",
    trust_policy_document="string",
    description="string",
    max_session_duration=0)
const roleResource = new volcengine.iam.Role("roleResource", {
    displayName: "string",
    roleName: "string",
    trustPolicyDocument: "string",
    description: "string",
    maxSessionDuration: 0,
});
type: volcengine:iam:Role
properties:
    description: string
    displayName: string
    maxSessionDuration: 0
    roleName: string
    trustPolicyDocument: string
Role 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 Role resource accepts the following input properties:
- DisplayName string
- The display name of the Role.
- RoleName string
- The name of the Role.
- TrustPolicy stringDocument 
- The trust policy document of the Role.
- Description string
- The description of the Role.
- MaxSession intDuration 
- The max session duration of the Role.
- DisplayName string
- The display name of the Role.
- RoleName string
- The name of the Role.
- TrustPolicy stringDocument 
- The trust policy document of the Role.
- Description string
- The description of the Role.
- MaxSession intDuration 
- The max session duration of the Role.
- displayName String
- The display name of the Role.
- roleName String
- The name of the Role.
- trustPolicy StringDocument 
- The trust policy document of the Role.
- description String
- The description of the Role.
- maxSession IntegerDuration 
- The max session duration of the Role.
- displayName string
- The display name of the Role.
- roleName string
- The name of the Role.
- trustPolicy stringDocument 
- The trust policy document of the Role.
- description string
- The description of the Role.
- maxSession numberDuration 
- The max session duration of the Role.
- display_name str
- The display name of the Role.
- role_name str
- The name of the Role.
- trust_policy_ strdocument 
- The trust policy document of the Role.
- description str
- The description of the Role.
- max_session_ intduration 
- The max session duration of the Role.
- displayName String
- The display name of the Role.
- roleName String
- The name of the Role.
- trustPolicy StringDocument 
- The trust policy document of the Role.
- description String
- The description of the Role.
- maxSession NumberDuration 
- The max session duration of the Role.
Outputs
All input properties are implicitly available as output properties. Additionally, the Role resource produces the following output properties:
Look up Existing Role Resource
Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        max_session_duration: Optional[int] = None,
        role_name: Optional[str] = None,
        trn: Optional[str] = None,
        trust_policy_document: Optional[str] = None) -> Rolefunc GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)public static Role get(String name, Output<String> id, RoleState state, CustomResourceOptions options)resources:  _:    type: volcengine:iam:Role    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.
- Description string
- The description of the Role.
- DisplayName string
- The display name of the Role.
- MaxSession intDuration 
- The max session duration of the Role.
- RoleName string
- The name of the Role.
- Trn string
- The resource name of the Role.
- TrustPolicy stringDocument 
- The trust policy document of the Role.
- Description string
- The description of the Role.
- DisplayName string
- The display name of the Role.
- MaxSession intDuration 
- The max session duration of the Role.
- RoleName string
- The name of the Role.
- Trn string
- The resource name of the Role.
- TrustPolicy stringDocument 
- The trust policy document of the Role.
- description String
- The description of the Role.
- displayName String
- The display name of the Role.
- maxSession IntegerDuration 
- The max session duration of the Role.
- roleName String
- The name of the Role.
- trn String
- The resource name of the Role.
- trustPolicy StringDocument 
- The trust policy document of the Role.
- description string
- The description of the Role.
- displayName string
- The display name of the Role.
- maxSession numberDuration 
- The max session duration of the Role.
- roleName string
- The name of the Role.
- trn string
- The resource name of the Role.
- trustPolicy stringDocument 
- The trust policy document of the Role.
- description str
- The description of the Role.
- display_name str
- The display name of the Role.
- max_session_ intduration 
- The max session duration of the Role.
- role_name str
- The name of the Role.
- trn str
- The resource name of the Role.
- trust_policy_ strdocument 
- The trust policy document of the Role.
- description String
- The description of the Role.
- displayName String
- The display name of the Role.
- maxSession NumberDuration 
- The max session duration of the Role.
- roleName String
- The name of the Role.
- trn String
- The resource name of the Role.
- trustPolicy StringDocument 
- The trust policy document of the Role.
Import
Iam role can be imported using the id, e.g.
$ pulumi import volcengine:iam/role:Role default TerraformTestRole
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the volcengineTerraform Provider.