Scaleway

v1.1.0 published on Saturday, Sep 17, 2022 by lbrlabs

Function

Creates and manages Scaleway Functions. For more information see the documentation.

Examples

Basic

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@lbrlabs/pulumi-scaleway";

const mainFunctionNamespace = new scaleway.FunctionNamespace("mainFunctionNamespace", {description: "Main function namespace"});
const mainFunction = new scaleway.Function("mainFunction", {
    namespaceId: mainFunctionNamespace.id,
    runtime: "go118",
    handler: "Handle",
    privacy: "private",
});
import pulumi
import lbrlabs_pulumi_scaleway as scaleway

main_function_namespace = scaleway.FunctionNamespace("mainFunctionNamespace", description="Main function namespace")
main_function = scaleway.Function("mainFunction",
    namespace_id=main_function_namespace.id,
    runtime="go118",
    handler="Handle",
    privacy="private")
using System.Collections.Generic;
using Pulumi;
using Scaleway = Lbrlabs.PulumiPackage.Scaleway;

return await Deployment.RunAsync(() => 
{
    var mainFunctionNamespace = new Scaleway.FunctionNamespace("mainFunctionNamespace", new()
    {
        Description = "Main function namespace",
    });

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

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		mainFunctionNamespace, err := scaleway.NewFunctionNamespace(ctx, "mainFunctionNamespace", &scaleway.FunctionNamespaceArgs{
			Description: pulumi.String("Main function namespace"),
		})
		if err != nil {
			return err
		}
		_, err = scaleway.NewFunction(ctx, "mainFunction", &scaleway.FunctionArgs{
			NamespaceId: mainFunctionNamespace.ID(),
			Runtime:     pulumi.String("go118"),
			Handler:     pulumi.String("Handle"),
			Privacy:     pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.FunctionNamespace;
import com.pulumi.scaleway.FunctionNamespaceArgs;
import com.pulumi.scaleway.Function;
import com.pulumi.scaleway.FunctionArgs;
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 mainFunctionNamespace = new FunctionNamespace("mainFunctionNamespace", FunctionNamespaceArgs.builder()        
            .description("Main function namespace")
            .build());

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

    }
}
resources:
  mainFunctionNamespace:
    type: scaleway:FunctionNamespace
    properties:
      description: Main function namespace
  mainFunction:
    type: scaleway:Function
    properties:
      namespaceId: ${mainFunctionNamespace.id}
      runtime: go118
      handler: Handle
      privacy: private

Create a Function Resource

new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             deploy: Optional[bool] = None,
             description: Optional[str] = None,
             environment_variables: Optional[Mapping[str, str]] = None,
             handler: Optional[str] = None,
             max_scale: Optional[int] = None,
             memory_limit: Optional[int] = None,
             min_scale: Optional[int] = None,
             name: Optional[str] = None,
             namespace_id: Optional[str] = None,
             privacy: Optional[str] = None,
             project_id: Optional[str] = None,
             region: Optional[str] = None,
             runtime: Optional[str] = None,
             timeout: Optional[str] = None,
             zip_file: Optional[str] = None,
             zip_hash: Optional[str] = None)
@overload
def Function(resource_name: str,
             args: FunctionArgs,
             opts: Optional[ResourceOptions] = None)
func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: scaleway:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FunctionArgs
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 FunctionArgs
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 FunctionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FunctionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FunctionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Handler string

Handler of the function. Depends on the runtime (function guide)

NamespaceId string

The namespace ID associated with this function

Privacy string

Privacy of the function. Can be either private or public. Read more on authentication

Runtime string

Runtime of the function. Runtimes can be fetched using specific route

Deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

Description string

The description of the function.

EnvironmentVariables Dictionary<string, string>

The environment variables of the function.

MaxScale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

MemoryLimit int

Memory limit in MB for your function, defaults to 128MB

MinScale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

Name string

The unique name of the function.

ProjectId string

project_id) The ID of the project the namespace is associated with.

Region string

region). The region in which the namespace should be created.

Timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

ZipFile string

Location of the zip file to upload containing your function sources

ZipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

Handler string

Handler of the function. Depends on the runtime (function guide)

NamespaceId string

The namespace ID associated with this function

Privacy string

Privacy of the function. Can be either private or public. Read more on authentication

Runtime string

Runtime of the function. Runtimes can be fetched using specific route

Deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

Description string

The description of the function.

EnvironmentVariables map[string]string

The environment variables of the function.

MaxScale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

MemoryLimit int

Memory limit in MB for your function, defaults to 128MB

MinScale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

Name string

The unique name of the function.

ProjectId string

project_id) The ID of the project the namespace is associated with.

Region string

region). The region in which the namespace should be created.

Timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

ZipFile string

Location of the zip file to upload containing your function sources

ZipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

handler String

Handler of the function. Depends on the runtime (function guide)

namespaceId String

The namespace ID associated with this function

privacy String

Privacy of the function. Can be either private or public. Read more on authentication

runtime String

Runtime of the function. Runtimes can be fetched using specific route

deploy Boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description String

The description of the function.

environmentVariables Map<String,String>

The environment variables of the function.

maxScale Integer

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit Integer

Memory limit in MB for your function, defaults to 128MB

minScale Integer

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name String

The unique name of the function.

projectId String

project_id) The ID of the project the namespace is associated with.

region String

region). The region in which the namespace should be created.

timeout String

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile String

Location of the zip file to upload containing your function sources

zipHash String

The hash of your source zip file, changing it will re-apply function. Can be any string

handler string

Handler of the function. Depends on the runtime (function guide)

namespaceId string

The namespace ID associated with this function

privacy string

Privacy of the function. Can be either private or public. Read more on authentication

runtime string

Runtime of the function. Runtimes can be fetched using specific route

deploy boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description string

The description of the function.

environmentVariables {[key: string]: string}

The environment variables of the function.

maxScale number

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit number

Memory limit in MB for your function, defaults to 128MB

minScale number

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name string

The unique name of the function.

projectId string

project_id) The ID of the project the namespace is associated with.

region string

region). The region in which the namespace should be created.

timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile string

Location of the zip file to upload containing your function sources

zipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

handler str

Handler of the function. Depends on the runtime (function guide)

namespace_id str

The namespace ID associated with this function

privacy str

Privacy of the function. Can be either private or public. Read more on authentication

runtime str

Runtime of the function. Runtimes can be fetched using specific route

deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

description str

The description of the function.

environment_variables Mapping[str, str]

The environment variables of the function.

max_scale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memory_limit int

Memory limit in MB for your function, defaults to 128MB

min_scale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name str

The unique name of the function.

project_id str

project_id) The ID of the project the namespace is associated with.

region str

region). The region in which the namespace should be created.

timeout str

Holds the max duration (in seconds) the function is allowed for responding to a request

zip_file str

Location of the zip file to upload containing your function sources

zip_hash str

The hash of your source zip file, changing it will re-apply function. Can be any string

handler String

Handler of the function. Depends on the runtime (function guide)

namespaceId String

The namespace ID associated with this function

privacy String

Privacy of the function. Can be either private or public. Read more on authentication

runtime String

Runtime of the function. Runtimes can be fetched using specific route

deploy Boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description String

The description of the function.

environmentVariables Map<String>

The environment variables of the function.

maxScale Number

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit Number

Memory limit in MB for your function, defaults to 128MB

minScale Number

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name String

The unique name of the function.

projectId String

project_id) The ID of the project the namespace is associated with.

region String

region). The region in which the namespace should be created.

timeout String

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile String

Location of the zip file to upload containing your function sources

zipHash String

The hash of your source zip file, changing it will re-apply function. Can be any string

Outputs

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

CpuLimit int

The CPU limit in mCPU for your function. More infos on resources here

DomainName string

The native domain name of the function

Id string

The provider-assigned unique ID for this managed resource.

OrganizationId string

The organization ID the function is associated with.

CpuLimit int

The CPU limit in mCPU for your function. More infos on resources here

DomainName string

The native domain name of the function

Id string

The provider-assigned unique ID for this managed resource.

OrganizationId string

The organization ID the function is associated with.

cpuLimit Integer

The CPU limit in mCPU for your function. More infos on resources here

domainName String

The native domain name of the function

id String

The provider-assigned unique ID for this managed resource.

organizationId String

The organization ID the function is associated with.

cpuLimit number

The CPU limit in mCPU for your function. More infos on resources here

domainName string

The native domain name of the function

id string

The provider-assigned unique ID for this managed resource.

organizationId string

The organization ID the function is associated with.

cpu_limit int

The CPU limit in mCPU for your function. More infos on resources here

domain_name str

The native domain name of the function

id str

The provider-assigned unique ID for this managed resource.

organization_id str

The organization ID the function is associated with.

cpuLimit Number

The CPU limit in mCPU for your function. More infos on resources here

domainName String

The native domain name of the function

id String

The provider-assigned unique ID for this managed resource.

organizationId String

The organization ID the function is associated with.

Look up an Existing Function Resource

Get an existing Function 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?: FunctionState, opts?: CustomResourceOptions): Function
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cpu_limit: Optional[int] = None,
        deploy: Optional[bool] = None,
        description: Optional[str] = None,
        domain_name: Optional[str] = None,
        environment_variables: Optional[Mapping[str, str]] = None,
        handler: Optional[str] = None,
        max_scale: Optional[int] = None,
        memory_limit: Optional[int] = None,
        min_scale: Optional[int] = None,
        name: Optional[str] = None,
        namespace_id: Optional[str] = None,
        organization_id: Optional[str] = None,
        privacy: Optional[str] = None,
        project_id: Optional[str] = None,
        region: Optional[str] = None,
        runtime: Optional[str] = None,
        timeout: Optional[str] = None,
        zip_file: Optional[str] = None,
        zip_hash: Optional[str] = None) -> Function
func GetFunction(ctx *Context, name string, id IDInput, state *FunctionState, opts ...ResourceOption) (*Function, error)
public static Function Get(string name, Input<string> id, FunctionState? state, CustomResourceOptions? opts = null)
public static Function get(String name, Output<String> id, FunctionState 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:
CpuLimit int

The CPU limit in mCPU for your function. More infos on resources here

Deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

Description string

The description of the function.

DomainName string

The native domain name of the function

EnvironmentVariables Dictionary<string, string>

The environment variables of the function.

Handler string

Handler of the function. Depends on the runtime (function guide)

MaxScale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

MemoryLimit int

Memory limit in MB for your function, defaults to 128MB

MinScale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

Name string

The unique name of the function.

NamespaceId string

The namespace ID associated with this function

OrganizationId string

The organization ID the function is associated with.

Privacy string

Privacy of the function. Can be either private or public. Read more on authentication

ProjectId string

project_id) The ID of the project the namespace is associated with.

Region string

region). The region in which the namespace should be created.

Runtime string

Runtime of the function. Runtimes can be fetched using specific route

Timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

ZipFile string

Location of the zip file to upload containing your function sources

ZipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

CpuLimit int

The CPU limit in mCPU for your function. More infos on resources here

Deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

Description string

The description of the function.

DomainName string

The native domain name of the function

EnvironmentVariables map[string]string

The environment variables of the function.

Handler string

Handler of the function. Depends on the runtime (function guide)

MaxScale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

MemoryLimit int

Memory limit in MB for your function, defaults to 128MB

MinScale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

Name string

The unique name of the function.

NamespaceId string

The namespace ID associated with this function

OrganizationId string

The organization ID the function is associated with.

Privacy string

Privacy of the function. Can be either private or public. Read more on authentication

ProjectId string

project_id) The ID of the project the namespace is associated with.

Region string

region). The region in which the namespace should be created.

Runtime string

Runtime of the function. Runtimes can be fetched using specific route

Timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

ZipFile string

Location of the zip file to upload containing your function sources

ZipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

cpuLimit Integer

The CPU limit in mCPU for your function. More infos on resources here

deploy Boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description String

The description of the function.

domainName String

The native domain name of the function

environmentVariables Map<String,String>

The environment variables of the function.

handler String

Handler of the function. Depends on the runtime (function guide)

maxScale Integer

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit Integer

Memory limit in MB for your function, defaults to 128MB

minScale Integer

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name String

The unique name of the function.

namespaceId String

The namespace ID associated with this function

organizationId String

The organization ID the function is associated with.

privacy String

Privacy of the function. Can be either private or public. Read more on authentication

projectId String

project_id) The ID of the project the namespace is associated with.

region String

region). The region in which the namespace should be created.

runtime String

Runtime of the function. Runtimes can be fetched using specific route

timeout String

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile String

Location of the zip file to upload containing your function sources

zipHash String

The hash of your source zip file, changing it will re-apply function. Can be any string

cpuLimit number

The CPU limit in mCPU for your function. More infos on resources here

deploy boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description string

The description of the function.

domainName string

The native domain name of the function

environmentVariables {[key: string]: string}

The environment variables of the function.

handler string

Handler of the function. Depends on the runtime (function guide)

maxScale number

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit number

Memory limit in MB for your function, defaults to 128MB

minScale number

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name string

The unique name of the function.

namespaceId string

The namespace ID associated with this function

organizationId string

The organization ID the function is associated with.

privacy string

Privacy of the function. Can be either private or public. Read more on authentication

projectId string

project_id) The ID of the project the namespace is associated with.

region string

region). The region in which the namespace should be created.

runtime string

Runtime of the function. Runtimes can be fetched using specific route

timeout string

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile string

Location of the zip file to upload containing your function sources

zipHash string

The hash of your source zip file, changing it will re-apply function. Can be any string

cpu_limit int

The CPU limit in mCPU for your function. More infos on resources here

deploy bool

Define if the function should be deployed, terraform will wait for function to be deployed

description str

The description of the function.

domain_name str

The native domain name of the function

environment_variables Mapping[str, str]

The environment variables of the function.

handler str

Handler of the function. Depends on the runtime (function guide)

max_scale int

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memory_limit int

Memory limit in MB for your function, defaults to 128MB

min_scale int

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name str

The unique name of the function.

namespace_id str

The namespace ID associated with this function

organization_id str

The organization ID the function is associated with.

privacy str

Privacy of the function. Can be either private or public. Read more on authentication

project_id str

project_id) The ID of the project the namespace is associated with.

region str

region). The region in which the namespace should be created.

runtime str

Runtime of the function. Runtimes can be fetched using specific route

timeout str

Holds the max duration (in seconds) the function is allowed for responding to a request

zip_file str

Location of the zip file to upload containing your function sources

zip_hash str

The hash of your source zip file, changing it will re-apply function. Can be any string

cpuLimit Number

The CPU limit in mCPU for your function. More infos on resources here

deploy Boolean

Define if the function should be deployed, terraform will wait for function to be deployed

description String

The description of the function.

domainName String

The native domain name of the function

environmentVariables Map<String>

The environment variables of the function.

handler String

Handler of the function. Depends on the runtime (function guide)

maxScale Number

Maximum replicas for your function (defaults to 20), our system will scale your functions automatically based on incoming workload, but will never scale the number of replicas above the configured max_scale.

memoryLimit Number

Memory limit in MB for your function, defaults to 128MB

minScale Number

Minimum replicas for your function, defaults to 0, Note that a function is billed when it gets executed, and using a min_scale greater than 0 will cause your function container to run constantly.

name String

The unique name of the function.

namespaceId String

The namespace ID associated with this function

organizationId String

The organization ID the function is associated with.

privacy String

Privacy of the function. Can be either private or public. Read more on authentication

projectId String

project_id) The ID of the project the namespace is associated with.

region String

region). The region in which the namespace should be created.

runtime String

Runtime of the function. Runtimes can be fetched using specific route

timeout String

Holds the max duration (in seconds) the function is allowed for responding to a request

zipFile String

Location of the zip file to upload containing your function sources

zipHash String

The hash of your source zip file, changing it will re-apply function. Can be any string

Import

Functions can be imported using the {region}/{id}, e.g. bash

 $ pulumi import scaleway:index/function:Function main fr-par/11111111-1111-1111-1111-111111111111

Package Details

Repository
https://github.com/lbrlabs/pulumi-scaleway
License
Apache-2.0
Notes

This Pulumi package is based on the scaleway Terraform Provider.