1. Packages
  2. Aiven
  3. API Docs
  4. OrganizationApplicationUserToken
Aiven v6.17.2 published on Thursday, Jun 6, 2024 by Pulumi

aiven.OrganizationApplicationUserToken

Explore with Pulumi AI

aiven logo
Aiven v6.17.2 published on Thursday, Jun 6, 2024 by Pulumi

    Creates and manages an application user token. Review the best practices for securing application users and their tokens.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const tfUser = new aiven.OrganizationApplicationUser("tf_user", {
        organizationId: main.id,
        name: "app-terraform",
    });
    const example = new aiven.OrganizationApplicationUserToken("example", {
        organizationId: main.id,
        userId: tfUser.userId,
        description: "Token for TF access to Aiven.",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    tf_user = aiven.OrganizationApplicationUser("tf_user",
        organization_id=main["id"],
        name="app-terraform")
    example = aiven.OrganizationApplicationUserToken("example",
        organization_id=main["id"],
        user_id=tf_user.user_id,
        description="Token for TF access to Aiven.")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tfUser, err := aiven.NewOrganizationApplicationUser(ctx, "tf_user", &aiven.OrganizationApplicationUserArgs{
    			OrganizationId: pulumi.Any(main.Id),
    			Name:           pulumi.String("app-terraform"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = aiven.NewOrganizationApplicationUserToken(ctx, "example", &aiven.OrganizationApplicationUserTokenArgs{
    			OrganizationId: pulumi.Any(main.Id),
    			UserId:         tfUser.UserId,
    			Description:    pulumi.String("Token for TF access to Aiven."),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var tfUser = new Aiven.OrganizationApplicationUser("tf_user", new()
        {
            OrganizationId = main.Id,
            Name = "app-terraform",
        });
    
        var example = new Aiven.OrganizationApplicationUserToken("example", new()
        {
            OrganizationId = main.Id,
            UserId = tfUser.UserId,
            Description = "Token for TF access to Aiven.",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.OrganizationApplicationUser;
    import com.pulumi.aiven.OrganizationApplicationUserArgs;
    import com.pulumi.aiven.OrganizationApplicationUserToken;
    import com.pulumi.aiven.OrganizationApplicationUserTokenArgs;
    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 tfUser = new OrganizationApplicationUser("tfUser", OrganizationApplicationUserArgs.builder()
                .organizationId(main.id())
                .name("app-terraform")
                .build());
    
            var example = new OrganizationApplicationUserToken("example", OrganizationApplicationUserTokenArgs.builder()
                .organizationId(main.id())
                .userId(tfUser.userId())
                .description("Token for TF access to Aiven.")
                .build());
    
        }
    }
    
    resources:
      tfUser:
        type: aiven:OrganizationApplicationUser
        name: tf_user
        properties:
          organizationId: ${main.id}
          name: app-terraform
      example:
        type: aiven:OrganizationApplicationUserToken
        properties:
          organizationId: ${main.id}
          userId: ${tfUser.userId}
          description: Token for TF access to Aiven.
    

    Create OrganizationApplicationUserToken Resource

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

    Constructor syntax

    new OrganizationApplicationUserToken(name: string, args: OrganizationApplicationUserTokenArgs, opts?: CustomResourceOptions);
    @overload
    def OrganizationApplicationUserToken(resource_name: str,
                                         args: OrganizationApplicationUserTokenArgs,
                                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def OrganizationApplicationUserToken(resource_name: str,
                                         opts: Optional[ResourceOptions] = None,
                                         organization_id: Optional[str] = None,
                                         user_id: Optional[str] = None,
                                         description: Optional[str] = None,
                                         extend_when_used: Optional[bool] = None,
                                         max_age_seconds: Optional[int] = None,
                                         scopes: Optional[Sequence[str]] = None)
    func NewOrganizationApplicationUserToken(ctx *Context, name string, args OrganizationApplicationUserTokenArgs, opts ...ResourceOption) (*OrganizationApplicationUserToken, error)
    public OrganizationApplicationUserToken(string name, OrganizationApplicationUserTokenArgs args, CustomResourceOptions? opts = null)
    public OrganizationApplicationUserToken(String name, OrganizationApplicationUserTokenArgs args)
    public OrganizationApplicationUserToken(String name, OrganizationApplicationUserTokenArgs args, CustomResourceOptions options)
    
    type: aiven:OrganizationApplicationUserToken
    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 OrganizationApplicationUserTokenArgs
    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 OrganizationApplicationUserTokenArgs
    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 OrganizationApplicationUserTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OrganizationApplicationUserTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OrganizationApplicationUserTokenArgs
    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 organizationApplicationUserTokenResource = new Aiven.OrganizationApplicationUserToken("organizationApplicationUserTokenResource", new()
    {
        OrganizationId = "string",
        UserId = "string",
        Description = "string",
        ExtendWhenUsed = false,
        MaxAgeSeconds = 0,
        Scopes = new[]
        {
            "string",
        },
    });
    
    example, err := aiven.NewOrganizationApplicationUserToken(ctx, "organizationApplicationUserTokenResource", &aiven.OrganizationApplicationUserTokenArgs{
    	OrganizationId: pulumi.String("string"),
    	UserId:         pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	ExtendWhenUsed: pulumi.Bool(false),
    	MaxAgeSeconds:  pulumi.Int(0),
    	Scopes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var organizationApplicationUserTokenResource = new OrganizationApplicationUserToken("organizationApplicationUserTokenResource", OrganizationApplicationUserTokenArgs.builder()
        .organizationId("string")
        .userId("string")
        .description("string")
        .extendWhenUsed(false)
        .maxAgeSeconds(0)
        .scopes("string")
        .build());
    
    organization_application_user_token_resource = aiven.OrganizationApplicationUserToken("organizationApplicationUserTokenResource",
        organization_id="string",
        user_id="string",
        description="string",
        extend_when_used=False,
        max_age_seconds=0,
        scopes=["string"])
    
    const organizationApplicationUserTokenResource = new aiven.OrganizationApplicationUserToken("organizationApplicationUserTokenResource", {
        organizationId: "string",
        userId: "string",
        description: "string",
        extendWhenUsed: false,
        maxAgeSeconds: 0,
        scopes: ["string"],
    });
    
    type: aiven:OrganizationApplicationUserToken
    properties:
        description: string
        extendWhenUsed: false
        maxAgeSeconds: 0
        organizationId: string
        scopes:
            - string
        userId: string
    

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

    OrganizationId string
    The ID of the organization the application user belongs to.
    UserId string
    The ID of the application user the token is created for.
    Description string
    Description of the token.
    ExtendWhenUsed bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    MaxAgeSeconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    Scopes List<string>
    Restricts the scopes for this token.
    OrganizationId string
    The ID of the organization the application user belongs to.
    UserId string
    The ID of the application user the token is created for.
    Description string
    Description of the token.
    ExtendWhenUsed bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    MaxAgeSeconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    Scopes []string
    Restricts the scopes for this token.
    organizationId String
    The ID of the organization the application user belongs to.
    userId String
    The ID of the application user the token is created for.
    description String
    Description of the token.
    extendWhenUsed Boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    maxAgeSeconds Integer
    The number of hours after which a token expires. Default session duration is 10 hours.
    scopes List<String>
    Restricts the scopes for this token.
    organizationId string
    The ID of the organization the application user belongs to.
    userId string
    The ID of the application user the token is created for.
    description string
    Description of the token.
    extendWhenUsed boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    maxAgeSeconds number
    The number of hours after which a token expires. Default session duration is 10 hours.
    scopes string[]
    Restricts the scopes for this token.
    organization_id str
    The ID of the organization the application user belongs to.
    user_id str
    The ID of the application user the token is created for.
    description str
    Description of the token.
    extend_when_used bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    max_age_seconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    scopes Sequence[str]
    Restricts the scopes for this token.
    organizationId String
    The ID of the organization the application user belongs to.
    userId String
    The ID of the application user the token is created for.
    description String
    Description of the token.
    extendWhenUsed Boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    maxAgeSeconds Number
    The number of hours after which a token expires. Default session duration is 10 hours.
    scopes List<String>
    Restricts the scopes for this token.

    Outputs

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

    CreateTime string
    Time when the token was created.
    CreatedManually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    CurrentlyActive bool
    True if the API request was made with this token.
    ExpiryTime string
    Timestamp when the access token will expire unless extended.
    FullToken string
    Full token.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastIp string
    IP address of the last request made with this token.
    LastUsedTime string
    Timestamp when the access token was last used.
    LastUserAgent string
    User agent of the last request made with this token.
    LastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    TokenPrefix string
    Prefix of the token.
    CreateTime string
    Time when the token was created.
    CreatedManually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    CurrentlyActive bool
    True if the API request was made with this token.
    ExpiryTime string
    Timestamp when the access token will expire unless extended.
    FullToken string
    Full token.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastIp string
    IP address of the last request made with this token.
    LastUsedTime string
    Timestamp when the access token was last used.
    LastUserAgent string
    User agent of the last request made with this token.
    LastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    TokenPrefix string
    Prefix of the token.
    createTime String
    Time when the token was created.
    createdManually Boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive Boolean
    True if the API request was made with this token.
    expiryTime String
    Timestamp when the access token will expire unless extended.
    fullToken String
    Full token.
    id String
    The provider-assigned unique ID for this managed resource.
    lastIp String
    IP address of the last request made with this token.
    lastUsedTime String
    Timestamp when the access token was last used.
    lastUserAgent String
    User agent of the last request made with this token.
    lastUserAgentHumanReadable String
    User agent of the last request made with this token in human-readable format.
    tokenPrefix String
    Prefix of the token.
    createTime string
    Time when the token was created.
    createdManually boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive boolean
    True if the API request was made with this token.
    expiryTime string
    Timestamp when the access token will expire unless extended.
    fullToken string
    Full token.
    id string
    The provider-assigned unique ID for this managed resource.
    lastIp string
    IP address of the last request made with this token.
    lastUsedTime string
    Timestamp when the access token was last used.
    lastUserAgent string
    User agent of the last request made with this token.
    lastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    tokenPrefix string
    Prefix of the token.
    create_time str
    Time when the token was created.
    created_manually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currently_active bool
    True if the API request was made with this token.
    expiry_time str
    Timestamp when the access token will expire unless extended.
    full_token str
    Full token.
    id str
    The provider-assigned unique ID for this managed resource.
    last_ip str
    IP address of the last request made with this token.
    last_used_time str
    Timestamp when the access token was last used.
    last_user_agent str
    User agent of the last request made with this token.
    last_user_agent_human_readable str
    User agent of the last request made with this token in human-readable format.
    token_prefix str
    Prefix of the token.
    createTime String
    Time when the token was created.
    createdManually Boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive Boolean
    True if the API request was made with this token.
    expiryTime String
    Timestamp when the access token will expire unless extended.
    fullToken String
    Full token.
    id String
    The provider-assigned unique ID for this managed resource.
    lastIp String
    IP address of the last request made with this token.
    lastUsedTime String
    Timestamp when the access token was last used.
    lastUserAgent String
    User agent of the last request made with this token.
    lastUserAgentHumanReadable String
    User agent of the last request made with this token in human-readable format.
    tokenPrefix String
    Prefix of the token.

    Look up Existing OrganizationApplicationUserToken Resource

    Get an existing OrganizationApplicationUserToken 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?: OrganizationApplicationUserTokenState, opts?: CustomResourceOptions): OrganizationApplicationUserToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            created_manually: Optional[bool] = None,
            currently_active: Optional[bool] = None,
            description: Optional[str] = None,
            expiry_time: Optional[str] = None,
            extend_when_used: Optional[bool] = None,
            full_token: Optional[str] = None,
            last_ip: Optional[str] = None,
            last_used_time: Optional[str] = None,
            last_user_agent: Optional[str] = None,
            last_user_agent_human_readable: Optional[str] = None,
            max_age_seconds: Optional[int] = None,
            organization_id: Optional[str] = None,
            scopes: Optional[Sequence[str]] = None,
            token_prefix: Optional[str] = None,
            user_id: Optional[str] = None) -> OrganizationApplicationUserToken
    func GetOrganizationApplicationUserToken(ctx *Context, name string, id IDInput, state *OrganizationApplicationUserTokenState, opts ...ResourceOption) (*OrganizationApplicationUserToken, error)
    public static OrganizationApplicationUserToken Get(string name, Input<string> id, OrganizationApplicationUserTokenState? state, CustomResourceOptions? opts = null)
    public static OrganizationApplicationUserToken get(String name, Output<String> id, OrganizationApplicationUserTokenState 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:
    CreateTime string
    Time when the token was created.
    CreatedManually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    CurrentlyActive bool
    True if the API request was made with this token.
    Description string
    Description of the token.
    ExpiryTime string
    Timestamp when the access token will expire unless extended.
    ExtendWhenUsed bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    FullToken string
    Full token.
    LastIp string
    IP address of the last request made with this token.
    LastUsedTime string
    Timestamp when the access token was last used.
    LastUserAgent string
    User agent of the last request made with this token.
    LastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    MaxAgeSeconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    OrganizationId string
    The ID of the organization the application user belongs to.
    Scopes List<string>
    Restricts the scopes for this token.
    TokenPrefix string
    Prefix of the token.
    UserId string
    The ID of the application user the token is created for.
    CreateTime string
    Time when the token was created.
    CreatedManually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    CurrentlyActive bool
    True if the API request was made with this token.
    Description string
    Description of the token.
    ExpiryTime string
    Timestamp when the access token will expire unless extended.
    ExtendWhenUsed bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    FullToken string
    Full token.
    LastIp string
    IP address of the last request made with this token.
    LastUsedTime string
    Timestamp when the access token was last used.
    LastUserAgent string
    User agent of the last request made with this token.
    LastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    MaxAgeSeconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    OrganizationId string
    The ID of the organization the application user belongs to.
    Scopes []string
    Restricts the scopes for this token.
    TokenPrefix string
    Prefix of the token.
    UserId string
    The ID of the application user the token is created for.
    createTime String
    Time when the token was created.
    createdManually Boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive Boolean
    True if the API request was made with this token.
    description String
    Description of the token.
    expiryTime String
    Timestamp when the access token will expire unless extended.
    extendWhenUsed Boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    fullToken String
    Full token.
    lastIp String
    IP address of the last request made with this token.
    lastUsedTime String
    Timestamp when the access token was last used.
    lastUserAgent String
    User agent of the last request made with this token.
    lastUserAgentHumanReadable String
    User agent of the last request made with this token in human-readable format.
    maxAgeSeconds Integer
    The number of hours after which a token expires. Default session duration is 10 hours.
    organizationId String
    The ID of the organization the application user belongs to.
    scopes List<String>
    Restricts the scopes for this token.
    tokenPrefix String
    Prefix of the token.
    userId String
    The ID of the application user the token is created for.
    createTime string
    Time when the token was created.
    createdManually boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive boolean
    True if the API request was made with this token.
    description string
    Description of the token.
    expiryTime string
    Timestamp when the access token will expire unless extended.
    extendWhenUsed boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    fullToken string
    Full token.
    lastIp string
    IP address of the last request made with this token.
    lastUsedTime string
    Timestamp when the access token was last used.
    lastUserAgent string
    User agent of the last request made with this token.
    lastUserAgentHumanReadable string
    User agent of the last request made with this token in human-readable format.
    maxAgeSeconds number
    The number of hours after which a token expires. Default session duration is 10 hours.
    organizationId string
    The ID of the organization the application user belongs to.
    scopes string[]
    Restricts the scopes for this token.
    tokenPrefix string
    Prefix of the token.
    userId string
    The ID of the application user the token is created for.
    create_time str
    Time when the token was created.
    created_manually bool
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currently_active bool
    True if the API request was made with this token.
    description str
    Description of the token.
    expiry_time str
    Timestamp when the access token will expire unless extended.
    extend_when_used bool
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    full_token str
    Full token.
    last_ip str
    IP address of the last request made with this token.
    last_used_time str
    Timestamp when the access token was last used.
    last_user_agent str
    User agent of the last request made with this token.
    last_user_agent_human_readable str
    User agent of the last request made with this token in human-readable format.
    max_age_seconds int
    The number of hours after which a token expires. Default session duration is 10 hours.
    organization_id str
    The ID of the organization the application user belongs to.
    scopes Sequence[str]
    Restricts the scopes for this token.
    token_prefix str
    Prefix of the token.
    user_id str
    The ID of the application user the token is created for.
    createTime String
    Time when the token was created.
    createdManually Boolean
    True for tokens explicitly created using the access_tokens API. False for tokens created when a user logs in.
    currentlyActive Boolean
    True if the API request was made with this token.
    description String
    Description of the token.
    expiryTime String
    Timestamp when the access token will expire unless extended.
    extendWhenUsed Boolean
    Extends the token session duration when the token is used. Only applicable if a value is set for max_age_seconds.
    fullToken String
    Full token.
    lastIp String
    IP address of the last request made with this token.
    lastUsedTime String
    Timestamp when the access token was last used.
    lastUserAgent String
    User agent of the last request made with this token.
    lastUserAgentHumanReadable String
    User agent of the last request made with this token in human-readable format.
    maxAgeSeconds Number
    The number of hours after which a token expires. Default session duration is 10 hours.
    organizationId String
    The ID of the organization the application user belongs to.
    scopes List<String>
    Restricts the scopes for this token.
    tokenPrefix String
    Prefix of the token.
    userId String
    The ID of the application user the token is created for.

    Import

    $ pulumi import aiven:index/organizationApplicationUserToken:OrganizationApplicationUserToken example ORGANIZATION_ID/USER_ID/TOKEN_PREFIX
    

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

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.17.2 published on Thursday, Jun 6, 2024 by Pulumi