1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. AuthToken
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

oci.Identity.AuthToken

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi

    This resource provides the Auth Token resource in Oracle Cloud Infrastructure Identity service.

    Creates a new auth token for the specified user. For information about what auth tokens are for, see Managing User Credentials.

    You must specify a description for the auth token (although it can be an empty string). It does not have to be unique, and you can change it anytime with UpdateAuthToken.

    Every user has permission to create an auth token for their own user ID. An administrator in your organization does not need to write a policy to give users this ability. To compare, administrators who have permission to the tenancy can use this operation to create an auth token for any user, including themselves.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testAuthToken = new oci.identity.AuthToken("test_auth_token", {
        description: authTokenDescription,
        userId: testUser.id,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_auth_token = oci.identity.AuthToken("test_auth_token",
        description=auth_token_description,
        user_id=test_user["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/Identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Identity.NewAuthToken(ctx, "test_auth_token", &Identity.AuthTokenArgs{
    			Description: pulumi.Any(authTokenDescription),
    			UserId:      pulumi.Any(testUser.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testAuthToken = new Oci.Identity.AuthToken("test_auth_token", new()
        {
            Description = authTokenDescription,
            UserId = testUser.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Identity.AuthToken;
    import com.pulumi.oci.Identity.AuthTokenArgs;
    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 testAuthToken = new AuthToken("testAuthToken", AuthTokenArgs.builder()
                .description(authTokenDescription)
                .userId(testUser.id())
                .build());
    
        }
    }
    
    resources:
      testAuthToken:
        type: oci:Identity:AuthToken
        name: test_auth_token
        properties:
          description: ${authTokenDescription}
          userId: ${testUser.id}
    

    Create AuthToken Resource

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

    Constructor syntax

    new AuthToken(name: string, args: AuthTokenArgs, opts?: CustomResourceOptions);
    @overload
    def AuthToken(resource_name: str,
                  args: AuthTokenArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def AuthToken(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  description: Optional[str] = None,
                  user_id: Optional[str] = None)
    func NewAuthToken(ctx *Context, name string, args AuthTokenArgs, opts ...ResourceOption) (*AuthToken, error)
    public AuthToken(string name, AuthTokenArgs args, CustomResourceOptions? opts = null)
    public AuthToken(String name, AuthTokenArgs args)
    public AuthToken(String name, AuthTokenArgs args, CustomResourceOptions options)
    
    type: oci:Identity:AuthToken
    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 AuthTokenArgs
    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 AuthTokenArgs
    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 AuthTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AuthTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AuthTokenArgs
    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 authTokenResource = new Oci.Identity.AuthToken("authTokenResource", new()
    {
        Description = "string",
        UserId = "string",
    });
    
    example, err := Identity.NewAuthToken(ctx, "authTokenResource", &Identity.AuthTokenArgs{
    	Description: pulumi.String("string"),
    	UserId:      pulumi.String("string"),
    })
    
    var authTokenResource = new AuthToken("authTokenResource", AuthTokenArgs.builder()
        .description("string")
        .userId("string")
        .build());
    
    auth_token_resource = oci.identity.AuthToken("authTokenResource",
        description="string",
        user_id="string")
    
    const authTokenResource = new oci.identity.AuthToken("authTokenResource", {
        description: "string",
        userId: "string",
    });
    
    type: oci:Identity:AuthToken
    properties:
        description: string
        userId: string
    

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

    Description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description String
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    userId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description str
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    user_id str

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description String
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The token's current state.
    TimeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    Token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    Id string
    The provider-assigned unique ID for this managed resource.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The token's current state.
    TimeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    Token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    id String
    The provider-assigned unique ID for this managed resource.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The token's current state.
    timeCreated String
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token String
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    id string
    The provider-assigned unique ID for this managed resource.
    inactiveState string
    The detailed status of INACTIVE lifecycleState.
    state string
    The token's current state.
    timeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    id str
    The provider-assigned unique ID for this managed resource.
    inactive_state str
    The detailed status of INACTIVE lifecycleState.
    state str
    The token's current state.
    time_created str
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    time_expires str
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token str
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    id String
    The provider-assigned unique ID for this managed resource.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The token's current state.
    timeCreated String
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token String
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.

    Look up Existing AuthToken Resource

    Get an existing AuthToken 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?: AuthTokenState, opts?: CustomResourceOptions): AuthToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            inactive_state: Optional[str] = None,
            state: Optional[str] = None,
            time_created: Optional[str] = None,
            time_expires: Optional[str] = None,
            token: Optional[str] = None,
            user_id: Optional[str] = None) -> AuthToken
    func GetAuthToken(ctx *Context, name string, id IDInput, state *AuthTokenState, opts ...ResourceOption) (*AuthToken, error)
    public static AuthToken Get(string name, Input<string> id, AuthTokenState? state, CustomResourceOptions? opts = null)
    public static AuthToken get(String name, Output<String> id, AuthTokenState 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:
    Description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The token's current state.
    TimeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    Token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    InactiveState string
    The detailed status of INACTIVE lifecycleState.
    State string
    The token's current state.
    TimeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    Token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    UserId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description String
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The token's current state.
    timeCreated String
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token String
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description string
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    inactiveState string
    The detailed status of INACTIVE lifecycleState.
    state string
    The token's current state.
    timeCreated string
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires string
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token string
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    userId string

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description str
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    inactive_state str
    The detailed status of INACTIVE lifecycleState.
    state str
    The token's current state.
    time_created str
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    time_expires str
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token str
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    user_id str

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    description String
    (Updatable) The description you assign to the auth token during creation. Does not have to be unique, and it's changeable.
    inactiveState String
    The detailed status of INACTIVE lifecycleState.
    state String
    The token's current state.
    timeCreated String
    Date and time the AuthToken object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this auth token will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    token String
    The auth token. The value is available only in the response for CreateAuthToken, and not for ListAuthTokens or UpdateAuthToken.
    userId String

    The OCID of the user.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Import

    AuthTokens can be imported using the id, e.g.

    $ pulumi import oci:Identity/authToken:AuthToken test_auth_token "users/{userId}/authTokens/{authTokenId}"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v2.11.0 published on Thursday, Sep 19, 2024 by Pulumi