okta.UserFactorQuestion
Explore with Pulumi AI
Creates security question factor for a user. This resource allows you to create and configure security question factor for a user.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";
const exampleUser = new okta.user.User("example", {
firstName: "John",
lastName: "Smith",
login: "john.smith@example.com",
email: "john.smith@example.com",
});
const example = okta.getUserSecurityQuestionsOutput({
userId: exampleUser.id,
});
const exampleFactor = new okta.factor.Factor("example", {
providerId: "okta_question",
active: true,
});
const exampleUserFactorQuestion = new okta.UserFactorQuestion("example", {
userId: exampleUser.id,
key: example.apply(example => example.questions?.[0]?.key),
answer: "meatball",
}, {
dependsOn: [exampleFactor],
});
import pulumi
import pulumi_okta as okta
example_user = okta.user.User("example",
first_name="John",
last_name="Smith",
login="john.smith@example.com",
email="john.smith@example.com")
example = okta.get_user_security_questions_output(user_id=example_user.id)
example_factor = okta.factor.Factor("example",
provider_id="okta_question",
active=True)
example_user_factor_question = okta.UserFactorQuestion("example",
user_id=example_user.id,
key=example.questions[0].key,
answer="meatball",
opts = pulumi.ResourceOptions(depends_on=[example_factor]))
package main
import (
"github.com/pulumi/pulumi-okta/sdk/v4/go/okta"
"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/factor"
"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/user"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleUser, err := user.NewUser(ctx, "example", &user.UserArgs{
FirstName: pulumi.String("John"),
LastName: pulumi.String("Smith"),
Login: pulumi.String("john.smith@example.com"),
Email: pulumi.String("john.smith@example.com"),
})
if err != nil {
return err
}
example := okta.GetUserSecurityQuestionsOutput(ctx, okta.GetUserSecurityQuestionsOutputArgs{
UserId: exampleUser.ID(),
}, nil)
exampleFactor, err := factor.NewFactor(ctx, "example", &factor.FactorArgs{
ProviderId: pulumi.String("okta_question"),
Active: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = okta.NewUserFactorQuestion(ctx, "example", &okta.UserFactorQuestionArgs{
UserId: exampleUser.ID(),
Key: pulumi.String(example.ApplyT(func(example okta.GetUserSecurityQuestionsResult) (*string, error) {
return &example.Questions[0].Key, nil
}).(pulumi.StringPtrOutput)),
Answer: pulumi.String("meatball"),
}, pulumi.DependsOn([]pulumi.Resource{
exampleFactor,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Okta = Pulumi.Okta;
return await Deployment.RunAsync(() =>
{
var exampleUser = new Okta.User.User("example", new()
{
FirstName = "John",
LastName = "Smith",
Login = "john.smith@example.com",
Email = "john.smith@example.com",
});
var example = Okta.GetUserSecurityQuestions.Invoke(new()
{
UserId = exampleUser.Id,
});
var exampleFactor = new Okta.Factor.Factor("example", new()
{
ProviderId = "okta_question",
Active = true,
});
var exampleUserFactorQuestion = new Okta.UserFactorQuestion("example", new()
{
UserId = exampleUser.Id,
Key = example.Apply(getUserSecurityQuestionsResult => getUserSecurityQuestionsResult.Questions[0]?.Key),
Answer = "meatball",
}, new CustomResourceOptions
{
DependsOn =
{
exampleFactor,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.okta.user.User;
import com.pulumi.okta.user.UserArgs;
import com.pulumi.okta.OktaFunctions;
import com.pulumi.okta.inputs.GetUserSecurityQuestionsArgs;
import com.pulumi.okta.factor.Factor;
import com.pulumi.okta.factor.FactorArgs;
import com.pulumi.okta.UserFactorQuestion;
import com.pulumi.okta.UserFactorQuestionArgs;
import com.pulumi.resources.CustomResourceOptions;
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 exampleUser = new User("exampleUser", UserArgs.builder()
.firstName("John")
.lastName("Smith")
.login("john.smith@example.com")
.email("john.smith@example.com")
.build());
final var example = OktaFunctions.getUserSecurityQuestions(GetUserSecurityQuestionsArgs.builder()
.userId(exampleUser.id())
.build());
var exampleFactor = new Factor("exampleFactor", FactorArgs.builder()
.providerId("okta_question")
.active(true)
.build());
var exampleUserFactorQuestion = new UserFactorQuestion("exampleUserFactorQuestion", UserFactorQuestionArgs.builder()
.userId(exampleUser.id())
.key(example.applyValue(getUserSecurityQuestionsResult -> getUserSecurityQuestionsResult).applyValue(example -> example.applyValue(getUserSecurityQuestionsResult -> getUserSecurityQuestionsResult.questions()[0].key())))
.answer("meatball")
.build(), CustomResourceOptions.builder()
.dependsOn(exampleFactor)
.build());
}
}
resources:
exampleUser:
type: okta:user:User
name: example
properties:
firstName: John
lastName: Smith
login: john.smith@example.com
email: john.smith@example.com
exampleFactor:
type: okta:factor:Factor
name: example
properties:
providerId: okta_question
active: true
exampleUserFactorQuestion:
type: okta:UserFactorQuestion
name: example
properties:
userId: ${exampleUser.id}
key: ${example.questions[0].key}
answer: meatball
options:
dependson:
- ${exampleFactor}
variables:
example:
fn::invoke:
Function: okta:getUserSecurityQuestions
Arguments:
userId: ${exampleUser.id}
Create UserFactorQuestion Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UserFactorQuestion(name: string, args: UserFactorQuestionArgs, opts?: CustomResourceOptions);
@overload
def UserFactorQuestion(resource_name: str,
args: UserFactorQuestionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UserFactorQuestion(resource_name: str,
opts: Optional[ResourceOptions] = None,
answer: Optional[str] = None,
key: Optional[str] = None,
user_id: Optional[str] = None)
func NewUserFactorQuestion(ctx *Context, name string, args UserFactorQuestionArgs, opts ...ResourceOption) (*UserFactorQuestion, error)
public UserFactorQuestion(string name, UserFactorQuestionArgs args, CustomResourceOptions? opts = null)
public UserFactorQuestion(String name, UserFactorQuestionArgs args)
public UserFactorQuestion(String name, UserFactorQuestionArgs args, CustomResourceOptions options)
type: okta:UserFactorQuestion
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 UserFactorQuestionArgs
- 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 UserFactorQuestionArgs
- 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 UserFactorQuestionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserFactorQuestionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserFactorQuestionArgs
- 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 userFactorQuestionResource = new Okta.UserFactorQuestion("userFactorQuestionResource", new()
{
Answer = "string",
Key = "string",
UserId = "string",
});
example, err := okta.NewUserFactorQuestion(ctx, "userFactorQuestionResource", &okta.UserFactorQuestionArgs{
Answer: pulumi.String("string"),
Key: pulumi.String("string"),
UserId: pulumi.String("string"),
})
var userFactorQuestionResource = new UserFactorQuestion("userFactorQuestionResource", UserFactorQuestionArgs.builder()
.answer("string")
.key("string")
.userId("string")
.build());
user_factor_question_resource = okta.UserFactorQuestion("userFactorQuestionResource",
answer="string",
key="string",
user_id="string")
const userFactorQuestionResource = new okta.UserFactorQuestion("userFactorQuestionResource", {
answer: "string",
key: "string",
userId: "string",
});
type: okta:UserFactorQuestion
properties:
answer: string
key: string
userId: string
UserFactorQuestion 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 UserFactorQuestion resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the UserFactorQuestion resource produces the following output properties:
Look up Existing UserFactorQuestion Resource
Get an existing UserFactorQuestion 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?: UserFactorQuestionState, opts?: CustomResourceOptions): UserFactorQuestion
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
answer: Optional[str] = None,
key: Optional[str] = None,
status: Optional[str] = None,
text: Optional[str] = None,
user_id: Optional[str] = None) -> UserFactorQuestion
func GetUserFactorQuestion(ctx *Context, name string, id IDInput, state *UserFactorQuestionState, opts ...ResourceOption) (*UserFactorQuestion, error)
public static UserFactorQuestion Get(string name, Input<string> id, UserFactorQuestionState? state, CustomResourceOptions? opts = null)
public static UserFactorQuestion get(String name, Output<String> id, UserFactorQuestionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Answer string
- Security question answer. Note here that answer won't be set during the resource import.
- Key string
- Security question unique key.
- Status string
- The status of the security question factor.
- Text string
- Display text for security question.
- User
Id string - ID of the user. Resource will be recreated when
user_id
changes.
- Answer string
- Security question answer. Note here that answer won't be set during the resource import.
- Key string
- Security question unique key.
- Status string
- The status of the security question factor.
- Text string
- Display text for security question.
- User
Id string - ID of the user. Resource will be recreated when
user_id
changes.
- answer String
- Security question answer. Note here that answer won't be set during the resource import.
- key String
- Security question unique key.
- status String
- The status of the security question factor.
- text String
- Display text for security question.
- user
Id String - ID of the user. Resource will be recreated when
user_id
changes.
- answer string
- Security question answer. Note here that answer won't be set during the resource import.
- key string
- Security question unique key.
- status string
- The status of the security question factor.
- text string
- Display text for security question.
- user
Id string - ID of the user. Resource will be recreated when
user_id
changes.
- answer str
- Security question answer. Note here that answer won't be set during the resource import.
- key str
- Security question unique key.
- status str
- The status of the security question factor.
- text str
- Display text for security question.
- user_
id str - ID of the user. Resource will be recreated when
user_id
changes.
- answer String
- Security question answer. Note here that answer won't be set during the resource import.
- key String
- Security question unique key.
- status String
- The status of the security question factor.
- text String
- Display text for security question.
- user
Id String - ID of the user. Resource will be recreated when
user_id
changes.
Import
$ pulumi import okta:index/userFactorQuestion:UserFactorQuestion example <user_id>/<question_factor_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
okta
Terraform Provider.