UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

256 lines 12.9 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Container = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * 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 */ 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, id, state, opts) { pulumi.log.warn("Container is deprecated: scaleway.index/container.Container has been deprecated in favor of scaleway.containers/container.Container"); return new Container(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Container.__pulumiType; } /** @deprecated scaleway.index/container.Container has been deprecated in favor of scaleway.containers/container.Container */ constructor(name, argsOrState, opts) { pulumi.log.warn("Container is deprecated: scaleway.index/container.Container has been deprecated in favor of scaleway.containers/container.Container"); let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cpuLimit"] = state ? state.cpuLimit : undefined; resourceInputs["cronStatus"] = state ? state.cronStatus : undefined; resourceInputs["deploy"] = state ? state.deploy : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["domainName"] = state ? state.domainName : undefined; resourceInputs["environmentVariables"] = state ? state.environmentVariables : undefined; resourceInputs["errorMessage"] = state ? state.errorMessage : undefined; resourceInputs["healthChecks"] = state ? state.healthChecks : undefined; resourceInputs["httpOption"] = state ? state.httpOption : undefined; resourceInputs["localStorageLimit"] = state ? state.localStorageLimit : undefined; resourceInputs["maxConcurrency"] = state ? state.maxConcurrency : undefined; resourceInputs["maxScale"] = state ? state.maxScale : undefined; resourceInputs["memoryLimit"] = state ? state.memoryLimit : undefined; resourceInputs["minScale"] = state ? state.minScale : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespaceId"] = state ? state.namespaceId : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["privacy"] = state ? state.privacy : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["registryImage"] = state ? state.registryImage : undefined; resourceInputs["registrySha256"] = state ? state.registrySha256 : undefined; resourceInputs["sandbox"] = state ? state.sandbox : undefined; resourceInputs["scalingOptions"] = state ? state.scalingOptions : undefined; resourceInputs["secretEnvironmentVariables"] = state ? state.secretEnvironmentVariables : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["timeout"] = state ? state.timeout : undefined; } else { const args = argsOrState; if ((!args || args.namespaceId === undefined) && !opts.urn) { throw new Error("Missing required property 'namespaceId'"); } resourceInputs["cpuLimit"] = args ? args.cpuLimit : undefined; resourceInputs["deploy"] = args ? args.deploy : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environmentVariables"] = args ? args.environmentVariables : undefined; resourceInputs["healthChecks"] = args ? args.healthChecks : undefined; resourceInputs["httpOption"] = args ? args.httpOption : undefined; resourceInputs["localStorageLimit"] = args ? args.localStorageLimit : undefined; resourceInputs["maxConcurrency"] = args ? args.maxConcurrency : undefined; resourceInputs["maxScale"] = args ? args.maxScale : undefined; resourceInputs["memoryLimit"] = args ? args.memoryLimit : undefined; resourceInputs["minScale"] = args ? args.minScale : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespaceId"] = args ? args.namespaceId : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["privacy"] = args ? args.privacy : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["registryImage"] = args ? args.registryImage : undefined; resourceInputs["registrySha256"] = args ? args.registrySha256 : undefined; resourceInputs["sandbox"] = args ? args.sandbox : undefined; resourceInputs["scalingOptions"] = args ? args.scalingOptions : undefined; resourceInputs["secretEnvironmentVariables"] = (args === null || args === void 0 ? void 0 : args.secretEnvironmentVariables) ? pulumi.secret(args.secretEnvironmentVariables) : undefined; resourceInputs["status"] = args ? args.status : undefined; resourceInputs["timeout"] = args ? args.timeout : undefined; resourceInputs["cronStatus"] = undefined /*out*/; resourceInputs["domainName"] = undefined /*out*/; resourceInputs["errorMessage"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secretEnvironmentVariables"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Container.__pulumiType, name, resourceInputs, opts); } } exports.Container = Container; /** @internal */ Container.__pulumiType = 'scaleway:index/container:Container'; //# sourceMappingURL=container.js.map