1. Packages
  2. Okta Provider
  3. API Docs
  4. policy
  5. getPolicy
Okta v6.1.0 published on Wednesday, Oct 29, 2025 by Pulumi

okta.policy.getPolicy

Start a Neo task
Explain and create an okta.policy.getPolicy resource
okta logo
Okta v6.1.0 published on Wednesday, Oct 29, 2025 by Pulumi

    Get a policy from Okta.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const example = okta.policy.getPolicy({
        name: "Password Policy Example",
        type: "PASSWORD",
    });
    
    import pulumi
    import pulumi_okta as okta
    
    example = okta.policy.get_policy(name="Password Policy Example",
        type="PASSWORD")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v6/go/okta/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := policy.GetPolicy(ctx, &policy.GetPolicyArgs{
    			Name: "Password Policy Example",
    			Type: "PASSWORD",
    		}, nil)
    		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 example = Okta.Policy.GetPolicy.Invoke(new()
        {
            Name = "Password Policy Example",
            Type = "PASSWORD",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.okta.policy.PolicyFunctions;
    import com.pulumi.okta.policy.inputs.GetPolicyArgs;
    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 example = PolicyFunctions.getPolicy(GetPolicyArgs.builder()
                .name("Password Policy Example")
                .type("PASSWORD")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: okta:policy:getPolicy
          arguments:
            name: Password Policy Example
            type: PASSWORD
    

    Using getPolicy

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
    function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>
    def get_policy(name: Optional[str] = None,
                   type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(name: Optional[pulumi.Input[str]] = None,
                   type: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]
    func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
    func GetPolicyOutput(ctx *Context, args *GetPolicyOutputArgs, opts ...InvokeOption) GetPolicyResultOutput

    > Note: This function is named GetPolicy in the Go SDK.

    public static class GetPolicy 
    {
        public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
    public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: okta:policy/getPolicy:getPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the policy
    Type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    Name string
    Name of the policy
    Type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    name String
    Name of the policy
    type String
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    name string
    Name of the policy
    type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    name str
    Name of the policy
    type str
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    name String
    Name of the policy
    type String
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object

    getPolicy Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the policy
    Status string
    Status of the policy
    Type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the policy
    Status string
    Status of the policy
    Type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the policy
    status String
    Status of the policy
    type String
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Name of the policy
    status string
    Status of the policy
    type string
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Name of the policy
    status str
    Status of the policy
    type str
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the policy
    status String
    Status of the policy
    type String
    Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object

    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 v6.1.0 published on Wednesday, Oct 29, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate