1. Packages
  2. Okta
  3. API Docs
  4. UserFactorQuestion
Okta v4.8.1 published on Thursday, Apr 18, 2024 by Pulumi

okta.UserFactorQuestion

Explore with Pulumi AI

okta logo
Okta v4.8.1 published on Thursday, Apr 18, 2024 by Pulumi

    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("exampleUser", {
        firstName: "John",
        lastName: "Smith",
        login: "john.smith@example.com",
        email: "john.smith@example.com",
    });
    const exampleUserSecurityQuestions = okta.getUserSecurityQuestionsOutput({
        userId: exampleUser.id,
    });
    const exampleFactor = new okta.factor.Factor("exampleFactor", {
        providerId: "okta_question",
        active: true,
    });
    const exampleUserFactorQuestion = new okta.UserFactorQuestion("exampleUserFactorQuestion", {
        userId: exampleUser.id,
        key: exampleUserSecurityQuestions.apply(exampleUserSecurityQuestions => exampleUserSecurityQuestions.questions?.[0]?.key),
        answer: "meatball",
    }, {
        dependsOn: [exampleFactor],
    });
    
    import pulumi
    import pulumi_okta as okta
    
    example_user = okta.user.User("exampleUser",
        first_name="John",
        last_name="Smith",
        login="john.smith@example.com",
        email="john.smith@example.com")
    example_user_security_questions = okta.get_user_security_questions_output(user_id=example_user.id)
    example_factor = okta.factor.Factor("exampleFactor",
        provider_id="okta_question",
        active=True)
    example_user_factor_question = okta.UserFactorQuestion("exampleUserFactorQuestion",
        user_id=example_user.id,
        key=example_user_security_questions.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, "exampleUser", &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
    		}
    		exampleUserSecurityQuestions := okta.GetUserSecurityQuestionsOutput(ctx, okta.GetUserSecurityQuestionsOutputArgs{
    			UserId: exampleUser.ID(),
    		}, nil)
    		exampleFactor, err := factor.NewFactor(ctx, "exampleFactor", &factor.FactorArgs{
    			ProviderId: pulumi.String("okta_question"),
    			Active:     pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = okta.NewUserFactorQuestion(ctx, "exampleUserFactorQuestion", &okta.UserFactorQuestionArgs{
    			UserId: exampleUser.ID(),
    			Key: exampleUserSecurityQuestions.ApplyT(func(exampleUserSecurityQuestions okta.GetUserSecurityQuestionsResult) (*string, error) {
    				return &exampleUserSecurityQuestions.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("exampleUser", new()
        {
            FirstName = "John",
            LastName = "Smith",
            Login = "john.smith@example.com",
            Email = "john.smith@example.com",
        });
    
        var exampleUserSecurityQuestions = Okta.GetUserSecurityQuestions.Invoke(new()
        {
            UserId = exampleUser.Id,
        });
    
        var exampleFactor = new Okta.Factor.Factor("exampleFactor", new()
        {
            ProviderId = "okta_question",
            Active = true,
        });
    
        var exampleUserFactorQuestion = new Okta.UserFactorQuestion("exampleUserFactorQuestion", new()
        {
            UserId = exampleUser.Id,
            Key = exampleUserSecurityQuestions.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 exampleUserSecurityQuestions = 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(exampleUserSecurityQuestions.applyValue(getUserSecurityQuestionsResult -> getUserSecurityQuestionsResult).applyValue(exampleUserSecurityQuestions -> exampleUserSecurityQuestions.applyValue(getUserSecurityQuestionsResult -> getUserSecurityQuestionsResult.questions()[0].key())))
                .answer("meatball")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(exampleFactor)
                    .build());
    
        }
    }
    
    resources:
      exampleUser:
        type: okta:user:User
        properties:
          firstName: John
          lastName: Smith
          login: john.smith@example.com
          email: john.smith@example.com
      exampleFactor:
        type: okta:factor:Factor
        properties:
          providerId: okta_question
          active: true
      exampleUserFactorQuestion:
        type: okta:UserFactorQuestion
        properties:
          userId: ${exampleUser.id}
          key: ${exampleUserSecurityQuestions.questions[0].key}
          answer: meatball
        options:
          dependson:
            - ${exampleFactor}
    variables:
      exampleUserSecurityQuestions:
        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.

    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

    The UserFactorQuestion resource accepts the following input properties:

    Answer string
    Security question answer. Note here that answer won't be set during the resource import.
    Key string
    Security question unique key.
    UserId 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.
    UserId 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.
    userId 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.
    userId 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.
    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.
    userId String
    ID of the user. Resource will be recreated when user_id changes.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the security question factor.
    Text string
    Display text for security question.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the security question factor.
    Text string
    Display text for security question.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the security question factor.
    text String
    Display text for security question.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the security question factor.
    text string
    Display text for security question.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the security question factor.
    text str
    Display text for security question.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the security question factor.
    text String
    Display text for security question.

    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.
    The following state arguments are supported:
    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.
    UserId 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.
    UserId 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.
    userId 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.
    userId 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.
    userId String
    ID of the user. Resource will be recreated when user_id changes.

    Import

    Security question factor for a user can be imported via the user_id and the factor_id.

    $ pulumi import okta:index/userFactorQuestion:UserFactorQuestion example &#60;user id&#62;/&#60;question factor id&#62;
    

    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.
    okta logo
    Okta v4.8.1 published on Thursday, Apr 18, 2024 by Pulumi