UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

529 lines (528 loc) 20.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * The `scaleway.containers.Container` resource allows you to create and manage [Serverless Containers](https://www.scaleway.com/en/docs/serverless/containers/). * * Refer to the Serverless Containers [product documentation](https://www.scaleway.com/en/docs/serverless/containers/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-containers/) for more information. * * For more information on the limitations of Serverless Containers, refer to the [dedicated documentation](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Namespace("main", { * name: "my-ns-test", * description: "test container", * }); * const mainContainer = new scaleway.containers.Container("main", { * name: "my-container-02", * description: "environment variables test", * namespaceId: main.id, * registryImage: pulumi.interpolate`${main.registryEndpoint}/alpine:test`, * port: 9997, * cpuLimit: 140, * memoryLimit: 256, * minScale: 3, * maxScale: 5, * timeout: 600, * maxConcurrency: 80, * privacy: "private", * protocol: "http1", * deploy: true, * environmentVariables: { * foo: "var", * }, * secretEnvironmentVariables: { * key: "secret", * }, * }); * ``` * * ## Protocols * * The following protocols are supported: * * * `h2c`: HTTP/2 over TCP. * * `http1`: Hypertext Transfer Protocol. * * > **Important:** Refer to the official [Apache documentation](https://httpd.apache.org/docs/2.4/howto/http2.html) for more information. * * ## Privacy * * By default, creating a container will make it `public`, meaning that anybody knowing the endpoint can execute it. * * A container can be made `private` with the privacy parameter. * * Refer to the [technical information](https://www.scaleway.com/en/developers/api/serverless-containers/#protocol-9dd4c8) for more information on container authentication. * * ## Memory and vCPUs configuration * * The vCPU represents a portion of the underlying, physical CPU that is assigned to a particular virtual machine (VM). * * You can determine the computing resources to allocate to each container. * * The `memoryLimit` (in MB) must correspond with the right amount of vCPU. Refer to the table below to determine the right memory/vCPU combination. * * | Memory (in MB) | vCPU | * |----------------|------| * | 128 | 70m | * | 256 | 140m | * | 512 | 280m | * | 1024 | 560m | * | 2048 | 1120 | * | 3072 | 1680 | * | 4096 | 2240 | * * ~>**Important:** Make sure to select the right resources, as you will be billed based on compute usage over time and the number of Containers executions. * Refer to the [Serverless Containers pricing](https://www.scaleway.com/en/docs/faq/serverless-containers/#prices) for more information. * * ## Health check configuration * * Custom health checks can be configured on the container. * * It's possible to specify the HTTP path that the probe will listen to and the number of failures before considering the container as unhealthy. * During a deployment, if a newly created container fails to pass the health check, the deployment is aborted. * As a result, lowering this value can help to reduce the time it takes to detect a failed deployment. * The period between health checks is also configurable. * * Example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Container("main", { * name: "my-container-02", * namespaceId: mainScalewayContainerNamespace.id, * healthChecks: [{ * https: [{ * path: "/ping", * }], * failureThreshold: 40, * interval: "5s", * }], * }); * ``` * * ~>**Important:** Another probe type can be set to TCP with the API, but currently the SDK has not been updated with this parameter. * This is why the only probe that can be used here is the HTTP probe. * Refer to the [Serverless Containers pricing](https://www.scaleway.com/en/docs/faq/serverless-containers/#prices) for more information. * * ## Scaling option configuration * * Scaling option block configuration allows you to choose which parameter will scale up/down containers. * Options are number of concurrent requests, CPU or memory usage. * It replaces current `maxConcurrency` that has been deprecated. * * Example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Container("main", { * name: "my-container-02", * namespaceId: mainScalewayContainerNamespace.id, * scalingOptions: [{ * concurrentRequestsThreshold: 15, * }], * }); * ``` * * ~>**Important**: A maximum of one of these parameters may be set. Also, when `cpuUsageThreshold` or `memoryUsageThreshold` are used, `minScale` can't be set to 0. * Refer to the [API Reference](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-create-a-new-container) for more information. * * ## Import * * Containers can be imported using, `{region}/{id}`, as shown below: * * bash * * ```sh * $ pulumi import scaleway:index/container:Container main fr-par/11111111-1111-1111-1111-111111111111 * ``` * * @deprecated scaleway.index/container.Container has been deprecated in favor of scaleway.containers/container.Container */ export declare class Container extends pulumi.CustomResource { /** * Get an existing Container resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ContainerState, opts?: pulumi.CustomResourceOptions): Container; /** * Returns true if the given object is an instance of Container. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Container; /** * The amount of vCPU computing resources to allocate to each container. */ readonly cpuLimit: pulumi.Output<number>; /** * The cron status of the container. */ readonly cronStatus: pulumi.Output<string>; /** * Boolean indicating whether the container is in a production environment. */ readonly deploy: pulumi.Output<boolean | undefined>; /** * The description of the container. */ readonly description: pulumi.Output<string | undefined>; /** * The native domain name of the container */ readonly domainName: pulumi.Output<string>; /** * The [environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#environment-variables) of the container. */ readonly environmentVariables: pulumi.Output<{ [key: string]: string; }>; /** * The error message of the container. */ readonly errorMessage: pulumi.Output<string>; /** * Health check configuration block of the container. */ readonly healthChecks: pulumi.Output<outputs.ContainerHealthCheck[]>; /** * Allows both HTTP and HTTPS (`enabled`) or redirect HTTP to HTTPS (`redirected`). Defaults to `enabled`. */ readonly httpOption: pulumi.Output<string | undefined>; /** * Local storage limit of the container (in MB) * * Note that if you want to use your own configuration, you must consult our configuration [restrictions](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/#configuration-restrictions) section. */ readonly localStorageLimit: pulumi.Output<number>; /** * The maximum number of simultaneous requests your container can handle at the same time. Use `scaling_option.concurrent_requests_threshold` instead. * * @deprecated Use scaling_option.concurrent_requests_threshold instead. This attribute will be removed. */ readonly maxConcurrency: pulumi.Output<number>; /** * The maximum number of instances this container can scale to. */ readonly maxScale: pulumi.Output<number>; /** * The memory resources in MB to allocate to each container. */ readonly memoryLimit: pulumi.Output<number>; /** * The minimum number of container instances running continuously. */ readonly minScale: pulumi.Output<number>; /** * The unique name of the container name. */ readonly name: pulumi.Output<string>; /** * The Containers namespace ID of the container. * * > **Important** Updating the `name` argument will recreate the container. */ readonly namespaceId: pulumi.Output<string>; /** * The port to expose the container. */ readonly port: pulumi.Output<number>; /** * The privacy type defines the way to authenticate to your container. Please check our dedicated [section](https://www.scaleway.com/en/developers/api/serverless-containers/#protocol-9dd4c8). */ readonly privacy: pulumi.Output<string | undefined>; /** * The communication [protocol](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) `http1` or `h2c`. Defaults to `http1`. */ readonly protocol: pulumi.Output<string | undefined>; /** * (Defaults to provider `region`) The region in which the container was created. */ readonly region: pulumi.Output<string>; /** * The registry image address (e.g., `rg.fr-par.scw.cloud/$NAMESPACE/$IMAGE`) */ readonly registryImage: pulumi.Output<string>; /** * The sha256 of your source registry image, changing it will re-apply the deployment. Can be any string. */ readonly registrySha256: pulumi.Output<string | undefined>; /** * Execution environment of the container. */ readonly sandbox: pulumi.Output<string>; /** * Configuration block used to decide when to scale up or down. Possible values: */ readonly scalingOptions: pulumi.Output<outputs.ContainerScalingOption[]>; /** * The [secret environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#secrets) of the container. */ readonly secretEnvironmentVariables: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The container status. */ readonly status: pulumi.Output<string>; /** * The maximum amount of time in seconds your container can spend processing a request before being stopped. Default to `300` seconds. */ readonly timeout: pulumi.Output<number>; /** * Create a Container resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ /** @deprecated scaleway.index/container.Container has been deprecated in favor of scaleway.containers/container.Container */ constructor(name: string, args: ContainerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Container resources. */ export interface ContainerState { /** * The amount of vCPU computing resources to allocate to each container. */ cpuLimit?: pulumi.Input<number>; /** * The cron status of the container. */ cronStatus?: pulumi.Input<string>; /** * Boolean indicating whether the container is in a production environment. */ deploy?: pulumi.Input<boolean>; /** * The description of the container. */ description?: pulumi.Input<string>; /** * The native domain name of the container */ domainName?: pulumi.Input<string>; /** * The [environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#environment-variables) of the container. */ environmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The error message of the container. */ errorMessage?: pulumi.Input<string>; /** * Health check configuration block of the container. */ healthChecks?: pulumi.Input<pulumi.Input<inputs.ContainerHealthCheck>[]>; /** * Allows both HTTP and HTTPS (`enabled`) or redirect HTTP to HTTPS (`redirected`). Defaults to `enabled`. */ httpOption?: pulumi.Input<string>; /** * Local storage limit of the container (in MB) * * Note that if you want to use your own configuration, you must consult our configuration [restrictions](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/#configuration-restrictions) section. */ localStorageLimit?: pulumi.Input<number>; /** * The maximum number of simultaneous requests your container can handle at the same time. Use `scaling_option.concurrent_requests_threshold` instead. * * @deprecated Use scaling_option.concurrent_requests_threshold instead. This attribute will be removed. */ maxConcurrency?: pulumi.Input<number>; /** * The maximum number of instances this container can scale to. */ maxScale?: pulumi.Input<number>; /** * The memory resources in MB to allocate to each container. */ memoryLimit?: pulumi.Input<number>; /** * The minimum number of container instances running continuously. */ minScale?: pulumi.Input<number>; /** * The unique name of the container name. */ name?: pulumi.Input<string>; /** * The Containers namespace ID of the container. * * > **Important** Updating the `name` argument will recreate the container. */ namespaceId?: pulumi.Input<string>; /** * The port to expose the container. */ port?: pulumi.Input<number>; /** * The privacy type defines the way to authenticate to your container. Please check our dedicated [section](https://www.scaleway.com/en/developers/api/serverless-containers/#protocol-9dd4c8). */ privacy?: pulumi.Input<string>; /** * The communication [protocol](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) `http1` or `h2c`. Defaults to `http1`. */ protocol?: pulumi.Input<string>; /** * (Defaults to provider `region`) The region in which the container was created. */ region?: pulumi.Input<string>; /** * The registry image address (e.g., `rg.fr-par.scw.cloud/$NAMESPACE/$IMAGE`) */ registryImage?: pulumi.Input<string>; /** * The sha256 of your source registry image, changing it will re-apply the deployment. Can be any string. */ registrySha256?: pulumi.Input<string>; /** * Execution environment of the container. */ sandbox?: pulumi.Input<string>; /** * Configuration block used to decide when to scale up or down. Possible values: */ scalingOptions?: pulumi.Input<pulumi.Input<inputs.ContainerScalingOption>[]>; /** * The [secret environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#secrets) of the container. */ secretEnvironmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The container status. */ status?: pulumi.Input<string>; /** * The maximum amount of time in seconds your container can spend processing a request before being stopped. Default to `300` seconds. */ timeout?: pulumi.Input<number>; } /** * The set of arguments for constructing a Container resource. */ export interface ContainerArgs { /** * The amount of vCPU computing resources to allocate to each container. */ cpuLimit?: pulumi.Input<number>; /** * Boolean indicating whether the container is in a production environment. */ deploy?: pulumi.Input<boolean>; /** * The description of the container. */ description?: pulumi.Input<string>; /** * The [environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#environment-variables) of the container. */ environmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Health check configuration block of the container. */ healthChecks?: pulumi.Input<pulumi.Input<inputs.ContainerHealthCheck>[]>; /** * Allows both HTTP and HTTPS (`enabled`) or redirect HTTP to HTTPS (`redirected`). Defaults to `enabled`. */ httpOption?: pulumi.Input<string>; /** * Local storage limit of the container (in MB) * * Note that if you want to use your own configuration, you must consult our configuration [restrictions](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/#configuration-restrictions) section. */ localStorageLimit?: pulumi.Input<number>; /** * The maximum number of simultaneous requests your container can handle at the same time. Use `scaling_option.concurrent_requests_threshold` instead. * * @deprecated Use scaling_option.concurrent_requests_threshold instead. This attribute will be removed. */ maxConcurrency?: pulumi.Input<number>; /** * The maximum number of instances this container can scale to. */ maxScale?: pulumi.Input<number>; /** * The memory resources in MB to allocate to each container. */ memoryLimit?: pulumi.Input<number>; /** * The minimum number of container instances running continuously. */ minScale?: pulumi.Input<number>; /** * The unique name of the container name. */ name?: pulumi.Input<string>; /** * The Containers namespace ID of the container. * * > **Important** Updating the `name` argument will recreate the container. */ namespaceId: pulumi.Input<string>; /** * The port to expose the container. */ port?: pulumi.Input<number>; /** * The privacy type defines the way to authenticate to your container. Please check our dedicated [section](https://www.scaleway.com/en/developers/api/serverless-containers/#protocol-9dd4c8). */ privacy?: pulumi.Input<string>; /** * The communication [protocol](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) `http1` or `h2c`. Defaults to `http1`. */ protocol?: pulumi.Input<string>; /** * (Defaults to provider `region`) The region in which the container was created. */ region?: pulumi.Input<string>; /** * The registry image address (e.g., `rg.fr-par.scw.cloud/$NAMESPACE/$IMAGE`) */ registryImage?: pulumi.Input<string>; /** * The sha256 of your source registry image, changing it will re-apply the deployment. Can be any string. */ registrySha256?: pulumi.Input<string>; /** * Execution environment of the container. */ sandbox?: pulumi.Input<string>; /** * Configuration block used to decide when to scale up or down. Possible values: */ scalingOptions?: pulumi.Input<pulumi.Input<inputs.ContainerScalingOption>[]>; /** * The [secret environment variables](https://www.scaleway.com/en/docs/serverless-containers/concepts/#secrets) of the container. */ secretEnvironmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The container status. */ status?: pulumi.Input<string>; /** * The maximum amount of time in seconds your container can spend processing a request before being stopped. Default to `300` seconds. */ timeout?: pulumi.Input<number>; }