Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as pulumi from "@pulumi/pulumi";
export const normal = pulumi.output("normal");
export const secret = pulumi.secret("secret");
// Kinda strange, but we are getting a stack reference to ourselves, and refercing the result of the /previous/
// deployment.
const org = new pulumi.Config().require("org");
const project = pulumi.getProject();
const stack = pulumi.getStack();
const sr = new pulumi.StackReference(`${org}/${project}/${stack}`);
export const refNormal = sr.getOutput("normal");
export const refSecret = sr.getOutput("secret");
import * as aws from "@pulumi/aws";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { config } from "./config";
const projectName = pulumi.getProject();
export const stdNodegroupIamRoleArn = config.stdNodegroupIamRoleArn
export const perfNodegroupIamRoleArn = config.perfNodegroupIamRoleArn
const stdNodegroupIamRoleName = stdNodegroupIamRoleArn.apply(s => s.split("/")).apply(s => s[1])
const perfNodegroupIamRoleName = perfNodegroupIamRoleArn.apply(s => s.split("/")).apply(s => s[1])
export const clusterName = config.clusterName
// Create a new IAM Policy for fluentd-cloudwatch to manage CloudWatch Logs.
const name = "fluentd-cloudwatch";
const fluentdCloudWatchPolicy = new aws.iam.Policy(name,
{
description: "Allows fluentd-cloudwatch to work with CloudWatch Logs.",
policy: JSON.stringify(
{
Version: "2012-10-17",
Statement: [{Effect: "Allow", Action: ["logs:*"], Resource: ["arn:aws:logs:*:*:*"]}]
getVolumeName() {
// Ensure this is unique to avoid conflicts both in EFS and in the
// TaskDefinition we pass to ECS.
return utils.sha1hash(`${pulumi.getProject()}:${pulumi.getStack()}:${this.kind}:${this.name}`);
}
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { config } from "./config";
const projectName = pulumi.getProject();
const provider = new k8s.Provider("provider", {
kubeconfig: config.kubeconfig,
});
export const appsNamespaceName = config.appsNamespaceName
// Deploy NGINX ingress controller using the Helm chart.
const nginx = new k8s.helm.v2.Chart("nginx",
{
namespace: config.appSvcsNamespaceName,
chart: "nginx-ingress",
version: "1.24.4",
fetchOpts: {repo: "https://kubernetes-charts.storage.googleapis.com/"},
values: {controller: {publishService: {enabled: true}}},
transformations: [
(obj: any) => {
// Do transformations on the YAML to set the namespace
import * as pulumi from "@pulumi/pulumi";
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
const projectName = pulumi.getProject();
// Create an EKS cluster with the default configuration.
const cluster1 = new eks.Cluster(`${projectName}-1`);
// Create an EKS cluster with a non-default configuration.
const vpc = new awsx.ec2.Vpc(`${projectName}-2`, {
tags: { "Name": `${projectName}-2` },
});
const cluster2 = new eks.Cluster(`${projectName}-2`, {
vpcId: vpc.id,
publicSubnetIds: vpc.publicSubnetIds,
desiredCapacity: 2,
minSize: 2,
maxSize: 2,
deployDashboard: false,
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { config } from "./config";
const name = pulumi.getProject();
// A k8s provider instance of the cluster.
const provider = new k8s.Provider(`${name}-aks`, {
kubeconfig: config.kubeconfig,
});
// Boot up nodejs Helm chart example using the MongoDB instance of CosmosDB from App Services.
const node = new k8s.helm.v2.Chart(
"node",
{
repo: "bitnami",
chart: "node",
version: "4.0.1",
values: {
serviceType: "LoadBalancer",
mongodb: { install: false },
import * as gcp from "@pulumi/gcp";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
import { config } from "./config";
const projectName = pulumi.getProject();
// const privateSubnetIds = config.privateSubnetIds;
// const securityGroupIds = config.securityGroupIds;
const clusterName = config.clusterName;
// Generate a strong password for the Postgres DB.
const postgresDbPassword = new random.RandomString(
`${projectName}-db-password`,
{
length: 20,
special: true,
},
{ additionalSecretOutputs: ["result"] },
).result;
// Create a Postgres DB instance.
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import * as echoserver from "./echoserver";
import * as iam from "./iam";
import * as nginx from "./nginx";
import * as utils from "./utils";
const projectName = pulumi.getProject();
// Allocate a new VPC with custom settings, and a public & private subnet per AZ.
const vpc = new awsx.ec2.Vpc(`${projectName}`, {
cidrBlock: "172.16.0.0/16",
subnets: [{ type: "public" }, { type: "private" }],
});
// Export VPC ID and Subnets.
export const vpcId = vpc.id;
export const allVpcSubnets = vpc.privateSubnetIds.concat(vpc.publicSubnetIds);
// Create 3 IAM Roles and matching InstanceProfiles to use with the nodegroups.
const roles = iam.createRoles(projectName, 3);
const instanceProfiles = iam.createInstanceProfiles(projectName, roles);
// Create an EKS cluster.
function createResource(runtime: string, dir: string) {
const p = pulumi.runtime.invoke("pulumi:pulumi:remoteConstructResource", {
runtime: runtime,
pwd: path.join(__dirname, dir),
path: "",
monitorAddr: process.env["PULUMI_NODEJS_MONITOR"],
dryRun: pulumi.runtime.isDryRun(),
project: pulumi.getProject(),
stack: "remote",
}, { async: true });
p.then(o => console.log(JSON.stringify(o)));
}