1. Packages
  2. Scaleway
  3. API Docs
  4. functions
  5. Token
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.functions.Token

Explore with Pulumi AI

The scaleway.functions.Token resource allows you to create and manage authentication tokens for Scaleway Serverless Functions.

Refer to the Functions tokens documentation and API documentation for more information.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";

const main = new scaleway.functions.Namespace("main", {name: "test-function-token-ns"});
const mainFunction = new scaleway.functions.Function("main", {
    namespaceId: main.id,
    runtime: "go118",
    handler: "Handle",
    privacy: "private",
});
// Namespace Token
const namespace = new scaleway.functions.Token("namespace", {
    namespaceId: main.id,
    expiresAt: "2022-10-18T11:35:15+02:00",
});
// Function Token
const _function = new scaleway.functions.Token("function", {functionId: mainFunction.id});
Copy
import pulumi
import pulumiverse_scaleway as scaleway

main = scaleway.functions.Namespace("main", name="test-function-token-ns")
main_function = scaleway.functions.Function("main",
    namespace_id=main.id,
    runtime="go118",
    handler="Handle",
    privacy="private")
# Namespace Token
namespace = scaleway.functions.Token("namespace",
    namespace_id=main.id,
    expires_at="2022-10-18T11:35:15+02:00")
# Function Token
function = scaleway.functions.Token("function", function_id=main_function.id)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/functions"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		main, err := functions.NewNamespace(ctx, "main", &functions.NamespaceArgs{
			Name: pulumi.String("test-function-token-ns"),
		})
		if err != nil {
			return err
		}
		mainFunction, err := functions.NewFunction(ctx, "main", &functions.FunctionArgs{
			NamespaceId: main.ID(),
			Runtime:     pulumi.String("go118"),
			Handler:     pulumi.String("Handle"),
			Privacy:     pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		// Namespace Token
		_, err = functions.NewToken(ctx, "namespace", &functions.TokenArgs{
			NamespaceId: main.ID(),
			ExpiresAt:   pulumi.String("2022-10-18T11:35:15+02:00"),
		})
		if err != nil {
			return err
		}
		// Function Token
		_, err = functions.NewToken(ctx, "function", &functions.TokenArgs{
			FunctionId: mainFunction.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    var main = new Scaleway.Functions.Namespace("main", new()
    {
        Name = "test-function-token-ns",
    });

    var mainFunction = new Scaleway.Functions.Function("main", new()
    {
        NamespaceId = main.Id,
        Runtime = "go118",
        Handler = "Handle",
        Privacy = "private",
    });

    // Namespace Token
    var @namespace = new Scaleway.Functions.Token("namespace", new()
    {
        NamespaceId = main.Id,
        ExpiresAt = "2022-10-18T11:35:15+02:00",
    });

    // Function Token
    var function = new Scaleway.Functions.Token("function", new()
    {
        FunctionId = mainFunction.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.functions.Namespace;
import com.pulumi.scaleway.functions.NamespaceArgs;
import com.pulumi.scaleway.functions.Function;
import com.pulumi.scaleway.functions.FunctionArgs;
import com.pulumi.scaleway.functions.Token;
import com.pulumi.scaleway.functions.TokenArgs;
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 main = new Namespace("main", NamespaceArgs.builder()
            .name("test-function-token-ns")
            .build());

        var mainFunction = new Function("mainFunction", FunctionArgs.builder()
            .namespaceId(main.id())
            .runtime("go118")
            .handler("Handle")
            .privacy("private")
            .build());

        // Namespace Token
        var namespace = new Token("namespace", TokenArgs.builder()
            .namespaceId(main.id())
            .expiresAt("2022-10-18T11:35:15+02:00")
            .build());

        // Function Token
        var function = new Token("function", TokenArgs.builder()
            .functionId(mainFunction.id())
            .build());

    }
}
Copy
resources:
  main:
    type: scaleway:functions:Namespace
    properties:
      name: test-function-token-ns
  mainFunction:
    type: scaleway:functions:Function
    name: main
    properties:
      namespaceId: ${main.id}
      runtime: go118
      handler: Handle
      privacy: private
  # Namespace Token
  namespace:
    type: scaleway:functions:Token
    properties:
      namespaceId: ${main.id}
      expiresAt: 2022-10-18T11:35:15+02:00
  # Function Token
  function:
    type: scaleway:functions:Token
    properties:
      functionId: ${mainFunction.id}
Copy

Create Token Resource

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

Constructor syntax

new Token(name: string, args?: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
          args: Optional[TokenArgs] = None,
          opts: Optional[ResourceOptions] = None)

@overload
def Token(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          description: Optional[str] = None,
          expires_at: Optional[str] = None,
          function_id: Optional[str] = None,
          namespace_id: Optional[str] = None,
          region: Optional[str] = None)
func NewToken(ctx *Context, name string, args *TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs? args = null, CustomResourceOptions? opts = null)
public Token(String name, TokenArgs args)
public Token(String name, TokenArgs args, CustomResourceOptions options)
type: scaleway:functions:Token
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args TokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args TokenArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args TokenArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args TokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TokenArgs
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 scalewayTokenResource = new Scaleway.Functions.Token("scalewayTokenResource", new()
{
    Description = "string",
    ExpiresAt = "string",
    FunctionId = "string",
    NamespaceId = "string",
    Region = "string",
});
Copy
example, err := functions.NewToken(ctx, "scalewayTokenResource", &functions.TokenArgs{
	Description: pulumi.String("string"),
	ExpiresAt:   pulumi.String("string"),
	FunctionId:  pulumi.String("string"),
	NamespaceId: pulumi.String("string"),
	Region:      pulumi.String("string"),
})
Copy
var scalewayTokenResource = new Token("scalewayTokenResource", TokenArgs.builder()
    .description("string")
    .expiresAt("string")
    .functionId("string")
    .namespaceId("string")
    .region("string")
    .build());
Copy
scaleway_token_resource = scaleway.functions.Token("scalewayTokenResource",
    description="string",
    expires_at="string",
    function_id="string",
    namespace_id="string",
    region="string")
Copy
const scalewayTokenResource = new scaleway.functions.Token("scalewayTokenResource", {
    description: "string",
    expiresAt: "string",
    functionId: "string",
    namespaceId: "string",
    region: "string",
});
Copy
type: scaleway:functions:Token
properties:
    description: string
    expiresAt: string
    functionId: string
    namespaceId: string
    region: string
Copy

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

Description Changes to this property will trigger replacement. string
The description of the token.
ExpiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
FunctionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

NamespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
Region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

Description Changes to this property will trigger replacement. string
The description of the token.
ExpiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
FunctionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

NamespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
Region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

description Changes to this property will trigger replacement. String
The description of the token.
expiresAt Changes to this property will trigger replacement. String
The expiration date of the token.
functionId Changes to this property will trigger replacement. String

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. String
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. String

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

description Changes to this property will trigger replacement. string
The description of the token.
expiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
functionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

description Changes to this property will trigger replacement. str
The description of the token.
expires_at Changes to this property will trigger replacement. str
The expiration date of the token.
function_id Changes to this property will trigger replacement. str

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespace_id Changes to this property will trigger replacement. str
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. str

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

description Changes to this property will trigger replacement. String
The description of the token.
expiresAt Changes to this property will trigger replacement. String
The expiration date of the token.
functionId Changes to this property will trigger replacement. String

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. String
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. String

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Value string
The token.
Id string
The provider-assigned unique ID for this managed resource.
Value string
The token.
id String
The provider-assigned unique ID for this managed resource.
value String
The token.
id string
The provider-assigned unique ID for this managed resource.
value string
The token.
id str
The provider-assigned unique ID for this managed resource.
value str
The token.
id String
The provider-assigned unique ID for this managed resource.
value String
The token.

Look up Existing Token Resource

Get an existing Token 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?: TokenState, opts?: CustomResourceOptions): Token
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        expires_at: Optional[str] = None,
        function_id: Optional[str] = None,
        namespace_id: Optional[str] = None,
        region: Optional[str] = None,
        value: Optional[str] = None) -> Token
func GetToken(ctx *Context, name string, id IDInput, state *TokenState, opts ...ResourceOption) (*Token, error)
public static Token Get(string name, Input<string> id, TokenState? state, CustomResourceOptions? opts = null)
public static Token get(String name, Output<String> id, TokenState state, CustomResourceOptions options)
resources:  _:    type: scaleway:functions:Token    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 Changes to this property will trigger replacement. string
The description of the token.
ExpiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
FunctionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

NamespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
Region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

Value string
The token.
Description Changes to this property will trigger replacement. string
The description of the token.
ExpiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
FunctionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

NamespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
Region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

Value string
The token.
description Changes to this property will trigger replacement. String
The description of the token.
expiresAt Changes to this property will trigger replacement. String
The expiration date of the token.
functionId Changes to this property will trigger replacement. String

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. String
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. String

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

value String
The token.
description Changes to this property will trigger replacement. string
The description of the token.
expiresAt Changes to this property will trigger replacement. string
The expiration date of the token.
functionId Changes to this property will trigger replacement. string

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. string
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. string

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

value string
The token.
description Changes to this property will trigger replacement. str
The description of the token.
expires_at Changes to this property will trigger replacement. str
The expiration date of the token.
function_id Changes to this property will trigger replacement. str

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespace_id Changes to this property will trigger replacement. str
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. str

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

value str
The token.
description Changes to this property will trigger replacement. String
The description of the token.
expiresAt Changes to this property will trigger replacement. String
The expiration date of the token.
functionId Changes to this property will trigger replacement. String

The unique identifier of the function.

Only one of namespace_id or function_id must be set.

namespaceId Changes to this property will trigger replacement. String
The unique identifier of the Functions namespace.
region Changes to this property will trigger replacement. String

region). The region in which the namespace is created.

Important Updating any of the arguments above will recreate the token.

value String
The token.

Import

Tokens can be imported using {region}/{id}, as shown below:

bash

$ pulumi import scaleway:functions/token:Token main fr-par/11111111-1111-1111-1111-111111111111
Copy

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

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.