@twingate/pulumi-twingate
Version:
A Pulumi package for creating and managing Twingate cloud resources.
118 lines • 5.33 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.TwingateKubernetesResource = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Kubernetes Resources are Twingate resources accessed via a Gateway.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as std from "@pulumi/std";
* import * as twingate from "@twingate/pulumi-twingate";
*
* const prod = new twingate.TwingateRemoteNetwork("prod", {name: "Production Network"});
* const tls = new twingate.TwingateX509CertificateAuthority("tls", {
* name: "My TLS CA",
* certificate: std.file({
* input: "ca.pem",
* }).then(invoke => invoke.result),
* });
* const main = new twingate.TwingateGateway("main", {
* remoteNetworkId: prod.id,
* address: "10.0.0.1:8443",
* x509CaId: tls.id,
* });
* // Kubernetes resource accessed via in-cluster DNS
* const prodCluster = new twingate.TwingateKubernetesResource("prod_cluster", {
* name: "Production K8s",
* gatewayId: main.id,
* remoteNetworkId: prod.id,
* });
* // Kubernetes resource accessed via external address
* const externalCluster = new twingate.TwingateKubernetesResource("external_cluster", {
* name: "External K8s",
* address: "k8s-api.example.com",
* gatewayId: main.id,
* remoteNetworkId: prod.id,
* });
* ```
*/
class TwingateKubernetesResource extends pulumi.CustomResource {
/**
* Get an existing TwingateKubernetesResource 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 TwingateKubernetesResource(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of TwingateKubernetesResource. 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'] === TwingateKubernetesResource.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessGroups"] = state?.accessGroups;
resourceInputs["accessPolicies"] = state?.accessPolicies;
resourceInputs["address"] = state?.address;
resourceInputs["alias"] = state?.alias;
resourceInputs["bearerTokenFile"] = state?.bearerTokenFile;
resourceInputs["caFile"] = state?.caFile;
resourceInputs["gatewayId"] = state?.gatewayId;
resourceInputs["inCluster"] = state?.inCluster;
resourceInputs["isVisible"] = state?.isVisible;
resourceInputs["name"] = state?.name;
resourceInputs["protocols"] = state?.protocols;
resourceInputs["remoteNetworkId"] = state?.remoteNetworkId;
resourceInputs["securityPolicyId"] = state?.securityPolicyId;
resourceInputs["tags"] = state?.tags;
}
else {
const args = argsOrState;
if (args?.gatewayId === undefined && !opts.urn) {
throw new Error("Missing required property 'gatewayId'");
}
if (args?.remoteNetworkId === undefined && !opts.urn) {
throw new Error("Missing required property 'remoteNetworkId'");
}
resourceInputs["accessGroups"] = args?.accessGroups;
resourceInputs["accessPolicies"] = args?.accessPolicies;
resourceInputs["address"] = args?.address;
resourceInputs["alias"] = args?.alias;
resourceInputs["bearerTokenFile"] = args?.bearerTokenFile;
resourceInputs["caFile"] = args?.caFile;
resourceInputs["gatewayId"] = args?.gatewayId;
resourceInputs["inCluster"] = args?.inCluster;
resourceInputs["isVisible"] = args?.isVisible;
resourceInputs["name"] = args?.name;
resourceInputs["protocols"] = args?.protocols;
resourceInputs["remoteNetworkId"] = args?.remoteNetworkId;
resourceInputs["securityPolicyId"] = args?.securityPolicyId;
resourceInputs["tags"] = args?.tags;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TwingateKubernetesResource.__pulumiType, name, resourceInputs, opts);
}
}
exports.TwingateKubernetesResource = TwingateKubernetesResource;
/** @internal */
TwingateKubernetesResource.__pulumiType = 'twingate:index/twingateKubernetesResource:TwingateKubernetesResource';
//# sourceMappingURL=twingateKubernetesResource.js.map