Role
Provides a Datadog role resource. This can be used to create and manage Datadog roles.
Example Usage
using Pulumi;
using Datadog = Pulumi.Datadog;
class MyStack : Stack
{
public MyStack()
{
var bar = Output.Create(Datadog.GetPermissions.InvokeAsync());
// Create a new Datadog role
var foo = new Datadog.Role("foo", new Datadog.RoleArgs
{
Name = "foo",
Permissions =
{
new Datadog.Inputs.RolePermissionArgs
{
Id = bar.Apply(bar => bar.Permissions.MonitorsDowntime),
},
new Datadog.Inputs.RolePermissionArgs
{
Id = bar.Apply(bar => bar.Permissions.MonitorsWrite),
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v2/go/datadog"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bar, err := datadog.GetPermissions(ctx, nil, nil)
if err != nil {
return err
}
_, err = datadog.NewRole(ctx, "foo", &datadog.RoleArgs{
Name: pulumi.String("foo"),
Permissions: datadog.RolePermissionArray{
&datadog.RolePermissionArgs{
Id: pulumi.String(bar.Permissions.MonitorsDowntime),
},
&datadog.RolePermissionArgs{
Id: pulumi.String(bar.Permissions.MonitorsWrite),
},
},
})
if err != nil {
return err
}
return nil
})
}
import pulumi
import pulumi_datadog as datadog
bar = datadog.get_permissions()
# Create a new Datadog role
foo = datadog.Role("foo",
name="foo",
permissions=[
datadog.RolePermissionArgs(
id=bar.permissions["monitorsDowntime"],
),
datadog.RolePermissionArgs(
id=bar.permissions["monitorsWrite"],
),
])
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
const bar = datadog.getPermissions({});
// Create a new Datadog role
const foo = new datadog.Role("foo", {
name: "foo",
permissions: [
{
id: bar.then(bar => bar.permissions.monitorsDowntime),
},
{
id: bar.then(bar => bar.permissions.monitorsWrite),
},
],
});
Create a Role Resource
new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);
def Role(resource_name: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, permissions: Optional[Sequence[RolePermissionArgs]] = None)
func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)
public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)
- 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.
- 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 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.
Role Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Role resource accepts the following input properties:
- Name string
Name of the role.
- Permissions
List<Role
Permission Args> Set of objects containing the permission ID and the name of the permissions granted to this role.
- Name string
Name of the role.
- Permissions
[]Role
Permission Set of objects containing the permission ID and the name of the permissions granted to this role.
- name string
Name of the role.
- permissions
Role
Permission[] Set of objects containing the permission ID and the name of the permissions granted to this role.
- name str
Name of the role.
- permissions
Sequence[Role
Permission Args] Set of objects containing the permission ID and the name of the permissions granted to this role.
Outputs
All input properties are implicitly available as output properties. Additionally, the Role resource produces the following output properties:
- id str
- The provider-assigned unique ID for this managed resource.
- user_
count int Number of users that have this role.
Look up an 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, name: Optional[str] = None, permissions: Optional[Sequence[RolePermissionArgs]] = None, user_count: Optional[int] = None) -> Role
func 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)
- 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:
- Name string
Name of the role.
- Permissions
List<Role
Permission Args> Set of objects containing the permission ID and the name of the permissions granted to this role.
- User
Count int Number of users that have this role.
- Name string
Name of the role.
- Permissions
[]Role
Permission Set of objects containing the permission ID and the name of the permissions granted to this role.
- User
Count int Number of users that have this role.
- name string
Name of the role.
- permissions
Role
Permission[] Set of objects containing the permission ID and the name of the permissions granted to this role.
- user
Count number Number of users that have this role.
- name str
Name of the role.
- permissions
Sequence[Role
Permission Args] Set of objects containing the permission ID and the name of the permissions granted to this role.
- user_
count int Number of users that have this role.
Supporting Types
RolePermission
Import
Roles can be imported using their ID, e.g.
$ pulumi import datadog:index/role:Role example_role 000000-0000-0000-0000-000000000000
Package Details
- Repository
- https://github.com/pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
datadog
Terraform Provider.