@lbrlabs/pulumi-scaleway
Version:
A Pulumi package for creating and managing scaleway cloud resources.
180 lines • 9.02 kB
JavaScript
;
// *** 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");
/**
* Creates and manages Scaleway Container.
*
* For more information consult the [documentation](https://www.scaleway.com/en/docs/faq/serverless-containers/).
*
* For more details about the limitation check [containers-limitations](https://www.scaleway.com/en/docs/compute/containers/reference-content/containers-limitations/).
*
* You can check also our [containers guide](https://www.scaleway.com/en/docs/compute/containers/concepts/).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const mainContainerNamespace = new scaleway.ContainerNamespace("mainContainerNamespace", {description: "test container"});
* const mainContainer = new scaleway.Container("mainContainer", {
* description: "environment variables test",
* namespaceId: mainContainerNamespace.id,
* registryImage: pulumi.interpolate`${mainContainerNamespace.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 supported protocols are:
*
* * `h2c`: HTTP/2 over TCP.
* * `http1`: Hypertext Transfer Protocol.
*
* **Important:** For details about the protocols check [this](https://httpd.apache.org/docs/2.4/howto/http2.html)
*
* ## Privacy
*
* By default, creating a container will make it `public`, meaning that anybody knowing the endpoint could execute it.
* A container can be made `private` with the privacy parameter.
*
* Please check our [authentication](https://developers.scaleway.com/en/products/containers/api/#protocol-9dd4c8) section
*
* ## Memory and vCPUs configuration
*
* The vCPU represents a portion or share of the underlying, physical CPU that is assigned to a particular virtual machine (VM).
*
* You may decide how much computing resources to allocate to each container.
* The `memoryLimit` (in MB) must correspond with the right amount of vCPU.
*
* **Important:** The right choice for your container's resources is very important, as you will be billed based on compute usage over time and the number of Containers executions.
*
* Please check our [price](https://www.scaleway.com/en/docs/faq/serverless-containers/#prices) section for more details.
*
* | Memory (in MB) | vCPU |
* |----------------|------|
* | 128 | 70m |
* | 256 | 140m |
* | 512 | 280m |
* | 1024 | 560m |
*
* **Note:** 560mCPU accounts roughly for half of one CPU power of a Scaleway General Purpose instance
*
* ## Import
*
* Container can be imported using the `{region}/{id}`, e.g. bash
*
* ```sh
* $ pulumi import scaleway:index/container:Container main fr-par/11111111-1111-1111-1111-111111111111
* ```
*/
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) {
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;
}
constructor(name, argsOrState, opts) {
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["httpOption"] = state ? state.httpOption : 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["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["httpOption"] = args ? args.httpOption : 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["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