1. Packages
  2. Okta Provider
  3. API Docs
  4. app
  5. AccessPolicyAssignment
Okta v4.11.3 published on Monday, Oct 21, 2024 by Pulumi

okta.app.AccessPolicyAssignment

Explore with Pulumi AI

okta logo
Okta v4.11.3 published on Monday, Oct 21, 2024 by Pulumi

    Manages assignment of Access Policy to an Application.

    Warning: do not use as this will update okta_app_*.authentication_policy and vice versa

    Assigns an access policy (colloquially known as a sign-on policy and/or an authentication policy) to an application. This resource does not perform true delete as it will not delete an application and the app’s access policy can’t be removed; it can only be changed to a different access policy. This resource is only logical within the context of an application therefore app_id is immutable once set. Use this resource to manage assigning an access policy to an application. It will assign the given policy_id to the application at creation and during update.

    Inside the product a sign-on policy is referenced as an authentication policy, in the public API the policy is of type ACCESS_POLICY.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const access = okta.policy.getPolicy({
        name: "Any two factors",
        type: "ACCESS_POLICY",
    });
    const example = okta.app.getApp({
        label: "Example App",
    });
    const assignment = new okta.app.AccessPolicyAssignment("assignment", {
        appId: example.then(example => example.id),
        policyId: access.then(access => access.id),
    });
    
    import pulumi
    import pulumi_okta as okta
    
    access = okta.policy.get_policy(name="Any two factors",
        type="ACCESS_POLICY")
    example = okta.app.get_app(label="Example App")
    assignment = okta.app.AccessPolicyAssignment("assignment",
        app_id=example.id,
        policy_id=access.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/app"
    	"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		access, err := policy.GetPolicy(ctx, &policy.GetPolicyArgs{
    			Name: "Any two factors",
    			Type: "ACCESS_POLICY",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := app.GetApp(ctx, &app.GetAppArgs{
    			Label: pulumi.StringRef("Example App"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = app.NewAccessPolicyAssignment(ctx, "assignment", &app.AccessPolicyAssignmentArgs{
    			AppId:    pulumi.String(example.Id),
    			PolicyId: pulumi.String(access.Id),
    		})
    		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 access = Okta.Policy.GetPolicy.Invoke(new()
        {
            Name = "Any two factors",
            Type = "ACCESS_POLICY",
        });
    
        var example = Okta.App.GetApp.Invoke(new()
        {
            Label = "Example App",
        });
    
        var assignment = new Okta.App.AccessPolicyAssignment("assignment", new()
        {
            AppId = example.Apply(getAppResult => getAppResult.Id),
            PolicyId = access.Apply(getPolicyResult => getPolicyResult.Id),
        });
    
    });
    
    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 com.pulumi.okta.app.AppFunctions;
    import com.pulumi.okta.app.inputs.GetAppArgs;
    import com.pulumi.okta.app.AccessPolicyAssignment;
    import com.pulumi.okta.app.AccessPolicyAssignmentArgs;
    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 access = PolicyFunctions.getPolicy(GetPolicyArgs.builder()
                .name("Any two factors")
                .type("ACCESS_POLICY")
                .build());
    
            final var example = AppFunctions.getApp(GetAppArgs.builder()
                .label("Example App")
                .build());
    
            var assignment = new AccessPolicyAssignment("assignment", AccessPolicyAssignmentArgs.builder()
                .appId(example.applyValue(getAppResult -> getAppResult.id()))
                .policyId(access.applyValue(getPolicyResult -> getPolicyResult.id()))
                .build());
    
        }
    }
    
    resources:
      assignment:
        type: okta:app:AccessPolicyAssignment
        properties:
          appId: ${example.id}
          policyId: ${access.id}
    variables:
      access:
        fn::invoke:
          Function: okta:policy:getPolicy
          Arguments:
            name: Any two factors
            type: ACCESS_POLICY
      example:
        fn::invoke:
          Function: okta:app:getApp
          Arguments:
            label: Example App
    

    Create AccessPolicyAssignment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AccessPolicyAssignment(name: string, args: AccessPolicyAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def AccessPolicyAssignment(resource_name: str,
                               args: AccessPolicyAssignmentArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccessPolicyAssignment(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               app_id: Optional[str] = None,
                               policy_id: Optional[str] = None)
    func NewAccessPolicyAssignment(ctx *Context, name string, args AccessPolicyAssignmentArgs, opts ...ResourceOption) (*AccessPolicyAssignment, error)
    public AccessPolicyAssignment(string name, AccessPolicyAssignmentArgs args, CustomResourceOptions? opts = null)
    public AccessPolicyAssignment(String name, AccessPolicyAssignmentArgs args)
    public AccessPolicyAssignment(String name, AccessPolicyAssignmentArgs args, CustomResourceOptions options)
    
    type: okta:app:AccessPolicyAssignment
    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 AccessPolicyAssignmentArgs
    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 AccessPolicyAssignmentArgs
    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 AccessPolicyAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccessPolicyAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccessPolicyAssignmentArgs
    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 accessPolicyAssignmentResource = new Okta.App.AccessPolicyAssignment("accessPolicyAssignmentResource", new()
    {
        AppId = "string",
        PolicyId = "string",
    });
    
    example, err := app.NewAccessPolicyAssignment(ctx, "accessPolicyAssignmentResource", &app.AccessPolicyAssignmentArgs{
    	AppId:    pulumi.String("string"),
    	PolicyId: pulumi.String("string"),
    })
    
    var accessPolicyAssignmentResource = new AccessPolicyAssignment("accessPolicyAssignmentResource", AccessPolicyAssignmentArgs.builder()
        .appId("string")
        .policyId("string")
        .build());
    
    access_policy_assignment_resource = okta.app.AccessPolicyAssignment("accessPolicyAssignmentResource",
        app_id="string",
        policy_id="string")
    
    const accessPolicyAssignmentResource = new okta.app.AccessPolicyAssignment("accessPolicyAssignmentResource", {
        appId: "string",
        policyId: "string",
    });
    
    type: okta:app:AccessPolicyAssignment
    properties:
        appId: string
        policyId: string
    

    AccessPolicyAssignment 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 AccessPolicyAssignment resource accepts the following input properties:

    AppId string
    The application ID; this value is immutable and can not be updated.
    PolicyId string
    The access policy ID.
    AppId string
    The application ID; this value is immutable and can not be updated.
    PolicyId string
    The access policy ID.
    appId String
    The application ID; this value is immutable and can not be updated.
    policyId String
    The access policy ID.
    appId string
    The application ID; this value is immutable and can not be updated.
    policyId string
    The access policy ID.
    app_id str
    The application ID; this value is immutable and can not be updated.
    policy_id str
    The access policy ID.
    appId String
    The application ID; this value is immutable and can not be updated.
    policyId String
    The access policy ID.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AccessPolicyAssignment 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 AccessPolicyAssignment Resource

    Get an existing AccessPolicyAssignment 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?: AccessPolicyAssignmentState, opts?: CustomResourceOptions): AccessPolicyAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            policy_id: Optional[str] = None) -> AccessPolicyAssignment
    func GetAccessPolicyAssignment(ctx *Context, name string, id IDInput, state *AccessPolicyAssignmentState, opts ...ResourceOption) (*AccessPolicyAssignment, error)
    public static AccessPolicyAssignment Get(string name, Input<string> id, AccessPolicyAssignmentState? state, CustomResourceOptions? opts = null)
    public static AccessPolicyAssignment get(String name, Output<String> id, AccessPolicyAssignmentState 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:
    AppId string
    The application ID; this value is immutable and can not be updated.
    PolicyId string
    The access policy ID.
    AppId string
    The application ID; this value is immutable and can not be updated.
    PolicyId string
    The access policy ID.
    appId String
    The application ID; this value is immutable and can not be updated.
    policyId String
    The access policy ID.
    appId string
    The application ID; this value is immutable and can not be updated.
    policyId string
    The access policy ID.
    app_id str
    The application ID; this value is immutable and can not be updated.
    policy_id str
    The access policy ID.
    appId String
    The application ID; this value is immutable and can not be updated.
    policyId String
    The access policy ID.

    Import

    $ pulumi import okta:app/accessPolicyAssignment:AccessPolicyAssignment example <app_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.
    okta logo
    Okta v4.11.3 published on Monday, Oct 21, 2024 by Pulumi