Resource to manage the assignment and unassignment of Custom Roles These operations allow the creation and manipulation of custom roles as custom collections of permissions.
NOTE: This an Early Access feature.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";
import * as std from "@pulumi/std";
const orgUrl = "https://mycompany.okta.com";
const test = new okta.AdminRoleCustom("test", {
label: "SomeUsersAndApps",
description: "Manage apps assignments and users",
permissions: [
"okta.apps.assignment.manage",
"okta.users.manage",
"okta.apps.manage",
],
});
const testSwa = new okta.app.Swa("test", {
label: "My SWA App",
buttonField: "btn-login",
passwordField: "txtbox-password",
usernameField: "txtbox-username",
url: "https://example.com/login.html",
});
const testResourceSet = new okta.ResourceSet("test", {
label: "UsersWithApp",
description: "All the users and SWA app",
resources: [
std.index.format({
input: "%s/api/v1/users",
args: [orgUrl],
}).result,
std.index.format({
input: "%s/api/v1/apps/%s",
args: [
orgUrl,
testSwa.id,
],
}).result,
],
});
// this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
// since direct assignment of custom roles is not allowed
const testUser = new okta.user.User("test", {
firstName: "Paul",
lastName: "Atreides",
login: "no-reply@caladan.planet",
email: "no-reply@caladan.planet",
});
const testGroup = new okta.group.Group("test", {
name: "General",
description: "General Group",
});
// this user and group will manage the set of resources based on the permissions specified in the custom role
const testAdminRoleCustomAssignments = new okta.AdminRoleCustomAssignments("test", {
resourceSetId: testResourceSet.id,
customRoleId: test.id,
members: [
std.index.format({
input: "%s/api/v1/users/%s",
args: [
orgUrl,
testUser.id,
],
}).result,
std.index.format({
input: "%s/api/v1/groups/%s",
args: [
orgUrl,
testGroup.id,
],
}).result,
],
});
import pulumi
import pulumi_okta as okta
import pulumi_std as std
org_url = "https://mycompany.okta.com"
test = okta.AdminRoleCustom("test",
label="SomeUsersAndApps",
description="Manage apps assignments and users",
permissions=[
"okta.apps.assignment.manage",
"okta.users.manage",
"okta.apps.manage",
])
test_swa = okta.app.Swa("test",
label="My SWA App",
button_field="btn-login",
password_field="txtbox-password",
username_field="txtbox-username",
url="https://example.com/login.html")
test_resource_set = okta.ResourceSet("test",
label="UsersWithApp",
description="All the users and SWA app",
resources=[
std.index.format(input="%s/api/v1/users",
args=[org_url])["result"],
std.index.format(input="%s/api/v1/apps/%s",
args=[
org_url,
test_swa.id,
])["result"],
])
# this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
# since direct assignment of custom roles is not allowed
test_user = okta.user.User("test",
first_name="Paul",
last_name="Atreides",
login="no-reply@caladan.planet",
email="no-reply@caladan.planet")
test_group = okta.group.Group("test",
name="General",
description="General Group")
# this user and group will manage the set of resources based on the permissions specified in the custom role
test_admin_role_custom_assignments = okta.AdminRoleCustomAssignments("test",
resource_set_id=test_resource_set.id,
custom_role_id=test.id,
members=[
std.index.format(input="%s/api/v1/users/%s",
args=[
org_url,
test_user.id,
])["result"],
std.index.format(input="%s/api/v1/groups/%s",
args=[
org_url,
test_group.id,
])["result"],
])
package main
import (
"github.com/pulumi/pulumi-okta/sdk/v6/go/okta"
"github.com/pulumi/pulumi-okta/sdk/v6/go/okta/app"
"github.com/pulumi/pulumi-okta/sdk/v6/go/okta/group"
"github.com/pulumi/pulumi-okta/sdk/v6/go/okta/user"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
orgUrl := "https://mycompany.okta.com"
test, err := okta.NewAdminRoleCustom(ctx, "test", &okta.AdminRoleCustomArgs{
Label: pulumi.String("SomeUsersAndApps"),
Description: pulumi.String("Manage apps assignments and users"),
Permissions: pulumi.StringArray{
pulumi.String("okta.apps.assignment.manage"),
pulumi.String("okta.users.manage"),
pulumi.String("okta.apps.manage"),
},
})
if err != nil {
return err
}
testSwa, err := app.NewSwa(ctx, "test", &app.SwaArgs{
Label: pulumi.String("My SWA App"),
ButtonField: pulumi.String("btn-login"),
PasswordField: pulumi.String("txtbox-password"),
UsernameField: pulumi.String("txtbox-username"),
Url: pulumi.String("https://example.com/login.html"),
})
if err != nil {
return err
}
invokeFormat, err := std.Format(ctx, map[string]interface{}{
"input": "%s/api/v1/users",
"args": []string{
orgUrl,
},
}, nil)
if err != nil {
return err
}
invokeFormat1, err := std.Format(ctx, map[string]interface{}{
"input": "%s/api/v1/apps/%s",
"args": []interface{}{
orgUrl,
testSwa.ID(),
},
}, nil)
if err != nil {
return err
}
testResourceSet, err := okta.NewResourceSet(ctx, "test", &okta.ResourceSetArgs{
Label: pulumi.String("UsersWithApp"),
Description: pulumi.String("All the users and SWA app"),
Resources: pulumi.StringArray{
invokeFormat.Result,
invokeFormat1.Result,
},
})
if err != nil {
return err
}
// this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
// since direct assignment of custom roles is not allowed
testUser, err := user.NewUser(ctx, "test", &user.UserArgs{
FirstName: pulumi.String("Paul"),
LastName: pulumi.String("Atreides"),
Login: pulumi.String("no-reply@caladan.planet"),
Email: pulumi.String("no-reply@caladan.planet"),
})
if err != nil {
return err
}
testGroup, err := group.NewGroup(ctx, "test", &group.GroupArgs{
Name: pulumi.String("General"),
Description: pulumi.String("General Group"),
})
if err != nil {
return err
}
invokeFormat2, err := std.Format(ctx, map[string]interface{}{
"input": "%s/api/v1/users/%s",
"args": []interface{}{
orgUrl,
testUser.ID(),
},
}, nil)
if err != nil {
return err
}
invokeFormat3, err := std.Format(ctx, map[string]interface{}{
"input": "%s/api/v1/groups/%s",
"args": []interface{}{
orgUrl,
testGroup.ID(),
},
}, nil)
if err != nil {
return err
}
// this user and group will manage the set of resources based on the permissions specified in the custom role
_, err = okta.NewAdminRoleCustomAssignments(ctx, "test", &okta.AdminRoleCustomAssignmentsArgs{
ResourceSetId: testResourceSet.ID(),
CustomRoleId: test.ID(),
Members: pulumi.StringArray{
invokeFormat2.Result,
invokeFormat3.Result,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Okta = Pulumi.Okta;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var orgUrl = "https://mycompany.okta.com";
var test = new Okta.AdminRoleCustom("test", new()
{
Label = "SomeUsersAndApps",
Description = "Manage apps assignments and users",
Permissions = new[]
{
"okta.apps.assignment.manage",
"okta.users.manage",
"okta.apps.manage",
},
});
var testSwa = new Okta.App.Swa("test", new()
{
Label = "My SWA App",
ButtonField = "btn-login",
PasswordField = "txtbox-password",
UsernameField = "txtbox-username",
Url = "https://example.com/login.html",
});
var testResourceSet = new Okta.ResourceSet("test", new()
{
Label = "UsersWithApp",
Description = "All the users and SWA app",
Resources = new[]
{
Std.Index.Format.Invoke(new()
{
Input = "%s/api/v1/users",
Args = new[]
{
orgUrl,
},
}).Result,
Std.Index.Format.Invoke(new()
{
Input = "%s/api/v1/apps/%s",
Args = new[]
{
orgUrl,
testSwa.Id,
},
}).Result,
},
});
// this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
// since direct assignment of custom roles is not allowed
var testUser = new Okta.User.User("test", new()
{
FirstName = "Paul",
LastName = "Atreides",
Login = "no-reply@caladan.planet",
Email = "no-reply@caladan.planet",
});
var testGroup = new Okta.Group.Group("test", new()
{
Name = "General",
Description = "General Group",
});
// this user and group will manage the set of resources based on the permissions specified in the custom role
var testAdminRoleCustomAssignments = new Okta.AdminRoleCustomAssignments("test", new()
{
ResourceSetId = testResourceSet.Id,
CustomRoleId = test.Id,
Members = new[]
{
Std.Index.Format.Invoke(new()
{
Input = "%s/api/v1/users/%s",
Args = new[]
{
orgUrl,
testUser.Id,
},
}).Result,
Std.Index.Format.Invoke(new()
{
Input = "%s/api/v1/groups/%s",
Args = new[]
{
orgUrl,
testGroup.Id,
},
}).Result,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.okta.AdminRoleCustom;
import com.pulumi.okta.AdminRoleCustomArgs;
import com.pulumi.okta.app.Swa;
import com.pulumi.okta.app.SwaArgs;
import com.pulumi.okta.ResourceSet;
import com.pulumi.okta.ResourceSetArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.okta.user.User;
import com.pulumi.okta.user.UserArgs;
import com.pulumi.okta.group.Group;
import com.pulumi.okta.group.GroupArgs;
import com.pulumi.okta.AdminRoleCustomAssignments;
import com.pulumi.okta.AdminRoleCustomAssignmentsArgs;
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 orgUrl = "https://mycompany.okta.com";
var test = new AdminRoleCustom("test", AdminRoleCustomArgs.builder()
.label("SomeUsersAndApps")
.description("Manage apps assignments and users")
.permissions(
"okta.apps.assignment.manage",
"okta.users.manage",
"okta.apps.manage")
.build());
var testSwa = new Swa("testSwa", SwaArgs.builder()
.label("My SWA App")
.buttonField("btn-login")
.passwordField("txtbox-password")
.usernameField("txtbox-username")
.url("https://example.com/login.html")
.build());
var testResourceSet = new ResourceSet("testResourceSet", ResourceSetArgs.builder()
.label("UsersWithApp")
.description("All the users and SWA app")
.resources(
StdFunctions.format(Map.ofEntries(
Map.entry("input", "%s/api/v1/users"),
Map.entry("args", orgUrl)
)).result(),
StdFunctions.format(Map.ofEntries(
Map.entry("input", "%s/api/v1/apps/%s"),
Map.entry("args",
orgUrl,
testSwa.id())
)).result())
.build());
// this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
// since direct assignment of custom roles is not allowed
var testUser = new User("testUser", UserArgs.builder()
.firstName("Paul")
.lastName("Atreides")
.login("no-reply@caladan.planet")
.email("no-reply@caladan.planet")
.build());
var testGroup = new Group("testGroup", GroupArgs.builder()
.name("General")
.description("General Group")
.build());
// this user and group will manage the set of resources based on the permissions specified in the custom role
var testAdminRoleCustomAssignments = new AdminRoleCustomAssignments("testAdminRoleCustomAssignments", AdminRoleCustomAssignmentsArgs.builder()
.resourceSetId(testResourceSet.id())
.customRoleId(test.id())
.members(
StdFunctions.format(Map.ofEntries(
Map.entry("input", "%s/api/v1/users/%s"),
Map.entry("args",
orgUrl,
testUser.id())
)).result(),
StdFunctions.format(Map.ofEntries(
Map.entry("input", "%s/api/v1/groups/%s"),
Map.entry("args",
orgUrl,
testGroup.id())
)).result())
.build());
}
}
resources:
test:
type: okta:AdminRoleCustom
properties:
label: SomeUsersAndApps
description: Manage apps assignments and users
permissions:
- okta.apps.assignment.manage
- okta.users.manage
- okta.apps.manage
testResourceSet:
type: okta:ResourceSet
name: test
properties:
label: UsersWithApp
description: All the users and SWA app
resources:
- fn::invoke:
function: std:format
arguments:
input: '%s/api/v1/users'
args:
- ${orgUrl}
return: result
- fn::invoke:
function: std:format
arguments:
input: '%s/api/v1/apps/%s'
args:
- ${orgUrl}
- ${testSwa.id}
return: result
# this user and group will manage the set of resources based on the permissions specified in the custom role
testAdminRoleCustomAssignments:
type: okta:AdminRoleCustomAssignments
name: test
properties:
resourceSetId: ${testResourceSet.id}
customRoleId: ${test.id}
members:
- fn::invoke:
function: std:format
arguments:
input: '%s/api/v1/users/%s'
args:
- ${orgUrl}
- ${testUser.id}
return: result
- fn::invoke:
function: std:format
arguments:
input: '%s/api/v1/groups/%s'
args:
- ${orgUrl}
- ${testGroup.id}
return: result
# this user will have `CUSTOM` role assigned, but it won't appear in the `admin_roles` for that user,
# // since direct assignment of custom roles is not allowed
testUser:
type: okta:user:User
name: test
properties:
firstName: Paul
lastName: Atreides
login: no-reply@caladan.planet
email: no-reply@caladan.planet
testSwa:
type: okta:app:Swa
name: test
properties:
label: My SWA App
buttonField: btn-login
passwordField: txtbox-password
usernameField: txtbox-username
url: https://example.com/login.html
testGroup:
type: okta:group:Group
name: test
properties:
name: General
description: General Group
variables:
orgUrl: https://mycompany.okta.com
Create AdminRoleCustomAssignments Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AdminRoleCustomAssignments(name: string, args: AdminRoleCustomAssignmentsArgs, opts?: CustomResourceOptions);@overload
def AdminRoleCustomAssignments(resource_name: str,
args: AdminRoleCustomAssignmentsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AdminRoleCustomAssignments(resource_name: str,
opts: Optional[ResourceOptions] = None,
custom_role_id: Optional[str] = None,
resource_set_id: Optional[str] = None,
members: Optional[Sequence[str]] = None)func NewAdminRoleCustomAssignments(ctx *Context, name string, args AdminRoleCustomAssignmentsArgs, opts ...ResourceOption) (*AdminRoleCustomAssignments, error)public AdminRoleCustomAssignments(string name, AdminRoleCustomAssignmentsArgs args, CustomResourceOptions? opts = null)
public AdminRoleCustomAssignments(String name, AdminRoleCustomAssignmentsArgs args)
public AdminRoleCustomAssignments(String name, AdminRoleCustomAssignmentsArgs args, CustomResourceOptions options)
type: okta:AdminRoleCustomAssignments
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 AdminRoleCustomAssignmentsArgs
- 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 AdminRoleCustomAssignmentsArgs
- 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 AdminRoleCustomAssignmentsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AdminRoleCustomAssignmentsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AdminRoleCustomAssignmentsArgs
- 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 adminRoleCustomAssignmentsResource = new Okta.AdminRoleCustomAssignments("adminRoleCustomAssignmentsResource", new()
{
CustomRoleId = "string",
ResourceSetId = "string",
Members = new[]
{
"string",
},
});
example, err := okta.NewAdminRoleCustomAssignments(ctx, "adminRoleCustomAssignmentsResource", &okta.AdminRoleCustomAssignmentsArgs{
CustomRoleId: pulumi.String("string"),
ResourceSetId: pulumi.String("string"),
Members: pulumi.StringArray{
pulumi.String("string"),
},
})
var adminRoleCustomAssignmentsResource = new AdminRoleCustomAssignments("adminRoleCustomAssignmentsResource", AdminRoleCustomAssignmentsArgs.builder()
.customRoleId("string")
.resourceSetId("string")
.members("string")
.build());
admin_role_custom_assignments_resource = okta.AdminRoleCustomAssignments("adminRoleCustomAssignmentsResource",
custom_role_id="string",
resource_set_id="string",
members=["string"])
const adminRoleCustomAssignmentsResource = new okta.AdminRoleCustomAssignments("adminRoleCustomAssignmentsResource", {
customRoleId: "string",
resourceSetId: "string",
members: ["string"],
});
type: okta:AdminRoleCustomAssignments
properties:
customRoleId: string
members:
- string
resourceSetId: string
AdminRoleCustomAssignments 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 AdminRoleCustomAssignments resource accepts the following input properties:
- Custom
Role stringId - ID of the Custom Role
- Resource
Set stringId - ID of the target Resource Set
- Members List<string>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- Custom
Role stringId - ID of the Custom Role
- Resource
Set stringId - ID of the target Resource Set
- Members []string
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- custom
Role StringId - ID of the Custom Role
- resource
Set StringId - ID of the target Resource Set
- members List<String>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- custom
Role stringId - ID of the Custom Role
- resource
Set stringId - ID of the target Resource Set
- members string[]
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- custom_
role_ strid - ID of the Custom Role
- resource_
set_ strid - ID of the target Resource Set
- members Sequence[str]
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- custom
Role StringId - ID of the Custom Role
- resource
Set StringId - ID of the target Resource Set
- members List<String>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
Outputs
All input properties are implicitly available as output properties. Additionally, the AdminRoleCustomAssignments 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 AdminRoleCustomAssignments Resource
Get an existing AdminRoleCustomAssignments 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?: AdminRoleCustomAssignmentsState, opts?: CustomResourceOptions): AdminRoleCustomAssignments@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
custom_role_id: Optional[str] = None,
members: Optional[Sequence[str]] = None,
resource_set_id: Optional[str] = None) -> AdminRoleCustomAssignmentsfunc GetAdminRoleCustomAssignments(ctx *Context, name string, id IDInput, state *AdminRoleCustomAssignmentsState, opts ...ResourceOption) (*AdminRoleCustomAssignments, error)public static AdminRoleCustomAssignments Get(string name, Input<string> id, AdminRoleCustomAssignmentsState? state, CustomResourceOptions? opts = null)public static AdminRoleCustomAssignments get(String name, Output<String> id, AdminRoleCustomAssignmentsState state, CustomResourceOptions options)resources: _: type: okta:AdminRoleCustomAssignments 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.
- Custom
Role stringId - ID of the Custom Role
- Members List<string>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- Resource
Set stringId - ID of the target Resource Set
- Custom
Role stringId - ID of the Custom Role
- Members []string
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- Resource
Set stringId - ID of the target Resource Set
- custom
Role StringId - ID of the Custom Role
- members List<String>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- resource
Set StringId - ID of the target Resource Set
- custom
Role stringId - ID of the Custom Role
- members string[]
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- resource
Set stringId - ID of the target Resource Set
- custom_
role_ strid - ID of the Custom Role
- members Sequence[str]
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- resource_
set_ strid - ID of the target Resource Set
- custom
Role StringId - ID of the Custom Role
- members List<String>
- The hrefs that point to User(s) and/or Group(s) that receive the Role
- resource
Set StringId - ID of the target Resource Set
Import
$ pulumi import okta:index/adminRoleCustomAssignments:AdminRoleCustomAssignments example <resource_set_id>/<custom_role_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Okta pulumi/pulumi-okta
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
oktaTerraform Provider.
