Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

RoleTempalte

Provides a Rancher v2 Role Template resource. This can be used to create Role Template for Rancher v2 and retrieve their information.

cluster and project scopes are supported for role templates.

Example Usage

using Pulumi;
using Rancher2 = Pulumi.Rancher2;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new rancher2 cluster Role Template
        var foo = new Rancher2.RoleTempalte("foo", new Rancher2.RoleTempalteArgs
        {
            Context = "cluster",
            DefaultRole = true,
            Description = "Terraform role template acceptance test",
            Rules = 
            {
                new Rancher2.Inputs.RoleTempalteRuleArgs
                {
                    ApiGroups = 
                    {
                        "*",
                    },
                    Resources = 
                    {
                        "secrets",
                    },
                    Verbs = 
                    {
                        "create",
                    },
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-rancher2/sdk/v2/go/rancher2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := rancher2.NewRoleTempalte(ctx, "foo", &rancher2.RoleTempalteArgs{
            Context:     pulumi.String("cluster"),
            DefaultRole: pulumi.Bool(true),
            Description: pulumi.String("Terraform role template acceptance test"),
            Rules: rancher2.RoleTempalteRuleArray{
                &rancher2.RoleTempalteRuleArgs{
                    ApiGroups: pulumi.StringArray{
                        pulumi.String("*"),
                    },
                    Resources: pulumi.StringArray{
                        pulumi.String("secrets"),
                    },
                    Verbs: pulumi.StringArray{
                        pulumi.String("create"),
                    },
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_rancher2 as rancher2

# Create a new rancher2 cluster Role Template
foo = rancher2.RoleTempalte("foo",
    context="cluster",
    default_role=True,
    description="Terraform role template acceptance test",
    rules=[rancher2.RoleTempalteRuleArgs(
        api_groups=["*"],
        resources=["secrets"],
        verbs=["create"],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as rancher2 from "@pulumi/rancher2";

// Create a new rancher2 cluster Role Template
const foo = new rancher2.RoleTempalte("foo", {
    context: "cluster",
    defaultRole: true,
    description: "Terraform role template acceptance test",
    rules: [{
        apiGroups: ["*"],
        resources: ["secrets"],
        verbs: ["create"],
    }],
});

Create a RoleTempalte Resource

new RoleTempalte(name: string, args?: RoleTempalteArgs, opts?: CustomResourceOptions);
def RoleTempalte(resource_name: str, opts: Optional[ResourceOptions] = None, administrative: Optional[bool] = None, annotations: Optional[Mapping[str, Any]] = None, context: Optional[str] = None, default_role: Optional[bool] = None, description: Optional[str] = None, external: Optional[bool] = None, hidden: Optional[bool] = None, labels: Optional[Mapping[str, Any]] = None, locked: Optional[bool] = None, name: Optional[str] = None, role_template_ids: Optional[Sequence[str]] = None, rules: Optional[Sequence[RoleTempalteRuleArgs]] = None)
func NewRoleTempalte(ctx *Context, name string, args *RoleTempalteArgs, opts ...ResourceOption) (*RoleTempalte, error)
public RoleTempalte(string name, RoleTempalteArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args RoleTempalteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RoleTempalteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RoleTempalteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

RoleTempalte Resource Properties

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

Inputs

The RoleTempalte resource accepts the following input properties:

Administrative bool

Administrative role template. Default false (bool)

Annotations Dictionary<string, object>

Annotations for role template object (map)

Context string

Role template context. cluster and project values are supported. Default: cluster (string)

DefaultRole bool

Default role template for new created cluster or project. Default false (bool)

Description string

Role template description (string)

External bool

External role template. Default false (bool)

Hidden bool

Hidden role template. Default false (bool)

Labels Dictionary<string, object>

Labels for role template object (map)

Locked bool

Locked role template. Default false (bool)

Name string

Role template name (string)

RoleTemplateIds List<string>

Inherit role template IDs (list)

Rules List<RoleTempalteRuleArgs>

Role template policy rules (list)

Administrative bool

Administrative role template. Default false (bool)

Annotations map[string]interface{}

Annotations for role template object (map)

Context string

Role template context. cluster and project values are supported. Default: cluster (string)

DefaultRole bool

Default role template for new created cluster or project. Default false (bool)

Description string

Role template description (string)

External bool

External role template. Default false (bool)

Hidden bool

Hidden role template. Default false (bool)

Labels map[string]interface{}

Labels for role template object (map)

Locked bool

Locked role template. Default false (bool)

Name string

Role template name (string)

RoleTemplateIds []string

Inherit role template IDs (list)

Rules []RoleTempalteRule

Role template policy rules (list)

administrative boolean

Administrative role template. Default false (bool)

annotations {[key: string]: any}

Annotations for role template object (map)

context string

Role template context. cluster and project values are supported. Default: cluster (string)

defaultRole boolean

Default role template for new created cluster or project. Default false (bool)

description string

Role template description (string)

external boolean

External role template. Default false (bool)

hidden boolean

Hidden role template. Default false (bool)

labels {[key: string]: any}

Labels for role template object (map)

locked boolean

Locked role template. Default false (bool)

name string

Role template name (string)

roleTemplateIds string[]

Inherit role template IDs (list)

rules RoleTempalteRule[]

Role template policy rules (list)

administrative bool

Administrative role template. Default false (bool)

annotations Mapping[str, Any]

Annotations for role template object (map)

context str

Role template context. cluster and project values are supported. Default: cluster (string)

default_role bool

Default role template for new created cluster or project. Default false (bool)

description str

Role template description (string)

external bool

External role template. Default false (bool)

hidden bool

Hidden role template. Default false (bool)

labels Mapping[str, Any]

Labels for role template object (map)

locked bool

Locked role template. Default false (bool)

name str

Role template name (string)

role_template_ids Sequence[str]

Inherit role template IDs (list)

rules Sequence[RoleTempalteRuleArgs]

Role template policy rules (list)

Outputs

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

Builtin bool

(Computed) Builtin role template (string)

Id string
The provider-assigned unique ID for this managed resource.
Builtin bool

(Computed) Builtin role template (string)

Id string
The provider-assigned unique ID for this managed resource.
builtin boolean

(Computed) Builtin role template (string)

id string
The provider-assigned unique ID for this managed resource.
builtin bool

(Computed) Builtin role template (string)

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

Look up an Existing RoleTempalte Resource

Get an existing RoleTempalte 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?: RoleTempalteState, opts?: CustomResourceOptions): RoleTempalte
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, administrative: Optional[bool] = None, annotations: Optional[Mapping[str, Any]] = None, builtin: Optional[bool] = None, context: Optional[str] = None, default_role: Optional[bool] = None, description: Optional[str] = None, external: Optional[bool] = None, hidden: Optional[bool] = None, labels: Optional[Mapping[str, Any]] = None, locked: Optional[bool] = None, name: Optional[str] = None, role_template_ids: Optional[Sequence[str]] = None, rules: Optional[Sequence[RoleTempalteRuleArgs]] = None) -> RoleTempalte
func GetRoleTempalte(ctx *Context, name string, id IDInput, state *RoleTempalteState, opts ...ResourceOption) (*RoleTempalte, error)
public static RoleTempalte Get(string name, Input<string> id, RoleTempalteState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Administrative bool

Administrative role template. Default false (bool)

Annotations Dictionary<string, object>

Annotations for role template object (map)

Builtin bool

(Computed) Builtin role template (string)

Context string

Role template context. cluster and project values are supported. Default: cluster (string)

DefaultRole bool

Default role template for new created cluster or project. Default false (bool)

Description string

Role template description (string)

External bool

External role template. Default false (bool)

Hidden bool

Hidden role template. Default false (bool)

Labels Dictionary<string, object>

Labels for role template object (map)

Locked bool

Locked role template. Default false (bool)

Name string

Role template name (string)

RoleTemplateIds List<string>

Inherit role template IDs (list)

Rules List<RoleTempalteRuleArgs>

Role template policy rules (list)

Administrative bool

Administrative role template. Default false (bool)

Annotations map[string]interface{}

Annotations for role template object (map)

Builtin bool

(Computed) Builtin role template (string)

Context string

Role template context. cluster and project values are supported. Default: cluster (string)

DefaultRole bool

Default role template for new created cluster or project. Default false (bool)

Description string

Role template description (string)

External bool

External role template. Default false (bool)

Hidden bool

Hidden role template. Default false (bool)

Labels map[string]interface{}

Labels for role template object (map)

Locked bool

Locked role template. Default false (bool)

Name string

Role template name (string)

RoleTemplateIds []string

Inherit role template IDs (list)

Rules []RoleTempalteRule

Role template policy rules (list)

administrative boolean

Administrative role template. Default false (bool)

annotations {[key: string]: any}

Annotations for role template object (map)

builtin boolean

(Computed) Builtin role template (string)

context string

Role template context. cluster and project values are supported. Default: cluster (string)

defaultRole boolean

Default role template for new created cluster or project. Default false (bool)

description string

Role template description (string)

external boolean

External role template. Default false (bool)

hidden boolean

Hidden role template. Default false (bool)

labels {[key: string]: any}

Labels for role template object (map)

locked boolean

Locked role template. Default false (bool)

name string

Role template name (string)

roleTemplateIds string[]

Inherit role template IDs (list)

rules RoleTempalteRule[]

Role template policy rules (list)

administrative bool

Administrative role template. Default false (bool)

annotations Mapping[str, Any]

Annotations for role template object (map)

builtin bool

(Computed) Builtin role template (string)

context str

Role template context. cluster and project values are supported. Default: cluster (string)

default_role bool

Default role template for new created cluster or project. Default false (bool)

description str

Role template description (string)

external bool

External role template. Default false (bool)

hidden bool

Hidden role template. Default false (bool)

labels Mapping[str, Any]

Labels for role template object (map)

locked bool

Locked role template. Default false (bool)

name str

Role template name (string)

role_template_ids Sequence[str]

Inherit role template IDs (list)

rules Sequence[RoleTempalteRuleArgs]

Role template policy rules (list)

Supporting Types

RoleTempalteRule

ApiGroups List<string>

Policy rule api groups (list)

NonResourceUrls List<string>

Policy rule non resource urls (list)

ResourceNames List<string>

Policy rule resource names (list)

Resources List<string>

Policy rule resources (list)

Verbs List<string>

Policy rule verbs. create, delete, get, list, patch, update, view, watch and * values are supported (list)

ApiGroups []string

Policy rule api groups (list)

NonResourceUrls []string

Policy rule non resource urls (list)

ResourceNames []string

Policy rule resource names (list)

Resources []string

Policy rule resources (list)

Verbs []string

Policy rule verbs. create, delete, get, list, patch, update, view, watch and * values are supported (list)

apiGroups string[]

Policy rule api groups (list)

nonResourceUrls string[]

Policy rule non resource urls (list)

resourceNames string[]

Policy rule resource names (list)

resources string[]

Policy rule resources (list)

verbs string[]

Policy rule verbs. create, delete, get, list, patch, update, view, watch and * values are supported (list)

api_groups Sequence[str]

Policy rule api groups (list)

non_resource_urls Sequence[str]

Policy rule non resource urls (list)

resource_names Sequence[str]

Policy rule resource names (list)

resources Sequence[str]

Policy rule resources (list)

verbs Sequence[str]

Policy rule verbs. create, delete, get, list, patch, update, view, watch and * values are supported (list)

Import

Role Template can be imported using the Rancher Role Template ID

 $ pulumi import rancher2:index/roleTempalte:RoleTempalte foo &lt;role_template_id&gt;

Package Details

Repository
https://github.com/pulumi/pulumi-rancher2
License
Apache-2.0
Notes
This Pulumi package is based on the rancher2 Terraform Provider.