Skip to content

Commit 735a711

Browse files
Use the new 0.17 api (#239)
1 parent 17a1450 commit 735a711

File tree

31 files changed

+129
-123
lines changed

31 files changed

+129
-123
lines changed

aws-js-containers/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const pulumi = require("@pulumi/pulumi");
12
const awsx = require("@pulumi/awsx");
23

34
let cluster = new awsx.ecs.Cluster("example", { });
@@ -17,4 +18,4 @@ let service = new awsx.ecs.FargateService("nginx", {
1718
});
1819

1920
// export just the hostname property of the container frontend
20-
exports.hostname = listener.endpoint.apply(e => `http://${e.hostname}`);
21+
exports.hostname = pulumi.interpolate `http://${listener.endpoint.hostname}`;

aws-js-webserver-component/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
const pulumi = require("@pulumi/pulumi");
2+
13
const webserver = require("./webserver.js");
24

35
let webInstance = webserver.createInstance("web-server-www", "t2.nano");
46
let appInstance = webserver.createInstance("web-server-app", "t2.micro");
57

6-
exports.webUrl = webInstance.publicDns.apply(dns => `http://${dns}`); // apply transformation to output property
8+
exports.webUrl = pulumi.interpolate `http://${webInstance.publicDns}`;

aws-ts-airflow/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let cacheCluster = new aws.elasticache.Cluster("cachecluster", {
5555
securityGroupIds: securityGroupIds,
5656
});
5757

58-
let hosts = pulumi.all([db.endpoint.apply(e => e.split(":")[0]), cacheCluster.cacheNodes.apply(n => n[0].address)]);
58+
let hosts = pulumi.all([db.endpoint.apply(e => e.split(":")[0]), cacheCluster.cacheNodes[0].address]);
5959
let environment = hosts.apply(([postgresHost, redisHost]) => [
6060
{ name: "POSTGRES_HOST", value: postgresHost },
6161
{ name: "POSTGRES_PASSWORD", value: dbPassword },
@@ -130,5 +130,5 @@ let airflowWorkers = new awsx.ecs.EC2Service("airflowworkers", {
130130
},
131131
});
132132

133-
export let airflowEndpoint = airflowControllerListener.endpoint().apply(e => e.hostname);
134-
export let flowerEndpoint = airflowerListener.endpoint().apply(e => e.hostname);
133+
export let airflowEndpoint = airflowControllerListener.endpoint().hostname;
134+
export let flowerEndpoint = airflowerListener.endpoint().hostname;

aws-ts-containers/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as pulumi from "@pulumi/pulumi";
12
import * as awsx from "@pulumi/awsx";
23

34
// Create an elastic network listener to listen for requests and route them to the container.
@@ -21,4 +22,4 @@ let service = new awsx.ecs.FargateService("nginx", {
2122
});
2223

2324
// export just the hostname property of the container frontend
24-
export const hostname = listener.endpoint().apply(e => `http://${e.hostname}`);
25+
export const hostname = pulumi.interpolate `http://${listener.endpoint.hostname}`;

aws-ts-eks-hello-world/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const kubeconfig = cluster.kubeconfig
2525
const ns = new k8s.core.v1.Namespace(name, {}, { provider: cluster.provider });
2626

2727
// Export the Namespace name
28-
export const namespaceName = ns.metadata.apply(m => m.name);
28+
export const namespaceName = ns.metadata.name;
2929

3030
// Create a NGINX Deployment
3131
const appLabels = { appClass: name };
@@ -60,7 +60,7 @@ const deployment = new k8s.apps.v1.Deployment(name,
6060
);
6161

6262
// Export the Deployment name
63-
export const deploymentName = deployment.metadata.apply(m => m.name);
63+
export const deploymentName = deployment.metadata.name;
6464

6565
// Create a LoadBalancer Service for the NGINX Deployment
6666
const service = new k8s.core.v1.Service(name,
@@ -81,5 +81,5 @@ const service = new k8s.core.v1.Service(name,
8181
);
8282

8383
// Export the Service name and public LoadBalancer Endpoint
84-
export const serviceName = service.metadata.apply(m => m.name);
84+
export const serviceName = service.metadata.name;
8585
export const serviceHostname = service.status.apply(s => s.loadBalancer.ingress[0].hostname)

aws-ts-resources/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const database = new aws.athena.Database("mydatabase", {
1010

1111
const namedQuery = new aws.athena.NamedQuery("mynamedquery", {
1212
database: database.id,
13-
query: database.id.apply(n => `SELECT * FROM ${n} limit 10;`)
13+
query: pulumi.interpolate `SELECT * FROM ${database.id} limit 10;`,
1414
});
1515

1616
// CloudWatch

aws-ts-ruby-on-rails/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as pulumi from "@pulumi/pulumi";
12
import * as aws from "@pulumi/aws";
23
import * as config from "./config";
34
import { getLinuxAmi } from "pawsami";
@@ -50,7 +51,7 @@ const webServer = new aws.ec2.Instance("webServer", {
5051
},
5152
},
5253
services: {
53-
"sysvinit": {
54+
"sysvinit": {
5455
"mysqld": { enabled: true, ensureRunning: true },
5556
},
5657
},
@@ -114,4 +115,4 @@ const webServer = new aws.ec2.Instance("webServer", {
114115
export let vmIP = webServer.publicIp;
115116

116117
// Export the URL for our newly created Rails application.
117-
export let websiteURL = webServer.publicDns.apply(url => `http://${url}/notes`);
118+
export let websiteURL = pulumi.interpolate `http://${webServer.publicDns}/notes`;

aws-ts-serverless-raw/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
22

3-
import * as aws from "@pulumi/aws";
43
import * as pulumi from "@pulumi/pulumi";
4+
import * as aws from "@pulumi/aws";
55

6-
// The location of the built dotnet2.0 application to deploy
6+
// The location of the built dotnet2.0 application to deploy
77
let dotNetApplicationPublishFolder = "./app/bin/Debug/netcoreapp2.0/publish";
88
let dotNetApplicationEntryPoint = "app::app.Functions::GetAsync";
99
// The stage name to use for the API Gateway URL
@@ -58,7 +58,7 @@ let lambda = new aws.lambda.Function("mylambda", {
5858
timeout: 300,
5959
handler: dotNetApplicationEntryPoint,
6060
role: role.arn,
61-
environment: {
61+
environment: {
6262
variables: {
6363
"COUNTER_TABLE": counterTable.name
6464
}
@@ -105,11 +105,11 @@ let restApi = new aws.apigateway.RestApi("api", {
105105
let deployment = new aws.apigateway.Deployment("api-deployment", {
106106
restApi: restApi,
107107
// Note: Set to empty to avoid creating an implicit stage, we'll create it explicitly below instead.
108-
stageName: "",
108+
stageName: "",
109109
});
110110

111111
// Create a stage, which is an addressable instance of the Rest API. Set it to point at the latest deployment.
112-
let stage = new aws.apigateway.Stage("api-stage", {
112+
let stage = new aws.apigateway.Stage("api-stage", {
113113
restApi: restApi,
114114
deployment: deployment,
115115
stageName: stageName
@@ -120,8 +120,8 @@ let invokePermission = new aws.lambda.Permission("api-lambda-permission", {
120120
action: "lambda:invokeFunction",
121121
function: lambda,
122122
principal: "apigateway.amazonaws.com",
123-
sourceArn: deployment.executionArn.apply(arn => arn + "*/*"),
123+
sourceArn: pulumi.interpolate `${deployment.executionArn}*/*`,
124124
});
125125

126126
// Export the https endpoint of the running Rest API
127-
export let endpoint = deployment.invokeUrl.apply(url => url + stageName);
127+
export let endpoint = pulumi.interpolate `${deployment.invokeUrl}${stageName}`;

aws-ts-static-website/index.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as aws from "@pulumi/aws";
21
import * as pulumi from "@pulumi/pulumi";
2+
import * as aws from "@pulumi/aws";
33

44
import * as fs from "fs";
55
import * as mime from "mime";
@@ -84,7 +84,7 @@ let certificateArn: pulumi.Input<string> = config.certificateArn!;
8484
* Only provision a certificate (and related resources) if a certificateArn is _not_ provided via configuration.
8585
*/
8686
if (config.certificateArn === undefined) {
87-
87+
8888
const eastRegion = new aws.Provider("east", {
8989
region: "us-east-1", // Per AWS, ACM certificate must be in the us-east-1 region.
9090
});
@@ -102,18 +102,18 @@ if (config.certificateArn === undefined) {
102102
* See https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-dns.html for more info.
103103
*/
104104
const certificateValidationDomain = new aws.route53.Record(`${config.targetDomain}-validation`, {
105-
name: certificate.domainValidationOptions.apply(d => d[0].resourceRecordName),
105+
name: certificate.domainValidationOptions[0].resourceRecordName,
106106
zoneId: hostedZoneId,
107-
type: certificate.domainValidationOptions.apply(d => d[0].resourceRecordType),
108-
records: [certificate.domainValidationOptions.apply(d => d[0].resourceRecordValue)],
107+
type: certificate.domainValidationOptions[0].resourceRecordType,
108+
records: [certificate.domainValidationOptions[0].resourceRecordValue],
109109
ttl: tenMinutes,
110110
});
111111

112112
/**
113-
* This is a _special_ resource that waits for ACM to complete validation via the DNS record
114-
* checking for a status of "ISSUED" on the certificate itself. No actual resources are
115-
* created (or updated or deleted).
116-
*
113+
* This is a _special_ resource that waits for ACM to complete validation via the DNS record
114+
* checking for a status of "ISSUED" on the certificate itself. No actual resources are
115+
* created (or updated or deleted).
116+
*
117117
* See https://www.terraform.io/docs/providers/aws/r/acm_certificate_validation.html for slightly more detail
118118
* and https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_acm_certificate_validation.go
119119
* for the actual implementation.
@@ -132,7 +132,7 @@ if (config.certificateArn === undefined) {
132132
const distributionArgs: aws.cloudfront.DistributionArgs = {
133133
enabled: true,
134134
// Alternate aliases the CloudFront distribution can be reached at, in addition to https://xxxx.cloudfront.net.
135-
// Required if you want to access the distribution via config.targetDomain as well.
135+
// Required if you want to access the distribution via config.targetDomain as well.
136136
aliases: [ config.targetDomain ],
137137

138138
// We only specify one origin for this distribution, the S3 content bucket.
@@ -248,7 +248,7 @@ const aRecord = createAliasRecord(config.targetDomain, cdn);
248248

249249
// Export properties from this stack. This prints them at the end of `pulumi up` and
250250
// makes them easier to access from the pulumi.com.
251-
export const contentBucketUri = contentBucket.bucket.apply(b => `s3://${b}`);
251+
export const contentBucketUri = pulumi.interpolate `s3://${contentBucket.bucket}`;
252252
export const contentBucketWebsiteEndpoint = contentBucket.websiteEndpoint;
253253
export const cloudFrontDomain = cdn.domainName;
254254
export const targetDomainEndpoint = `https://${config.targetDomain}/`;

aws-ts-url-shortener-cache-http/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
22

3+
import * as pulumi from "@pulumi/pulumi";
34
import * as aws from "@pulumi/aws";
45
import * as awsx from "@pulumi/awsx";
56
import * as cloud from "@pulumi/cloud-aws";
@@ -104,4 +105,4 @@ let httpServer = new cloud.HttpServer("urlshortener", () => {
104105
return app;
105106
});
106107

107-
export let endpointUrl = httpServer.url.apply(u => u + "index.html");
108+
export let endpointUrl = pulumi.interpolate `${httpServer.url}index.html`;

azure-ts-appservice/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ const username = "pulumi";
6363

6464
// Get the password to use for SQL from config.
6565
const config = new pulumi.Config();
66-
const pwd = config.require("sqlPassword");
66+
const pwd = config.require("sqlPassword");
6767

6868
const sqlServer = new azure.sql.SqlServer(`${prefix}-sql`, {
6969
...resourceGroupArgs,
7070

7171
administratorLogin: username,
7272
administratorLoginPassword: pwd,
73-
version: "12.0",
73+
version: "12.0",
7474
});
7575

7676
const database = new azure.sql.Database(`${prefix}-db`, {
@@ -93,11 +93,11 @@ const app = new azure.appservice.AppService(`${prefix}-as`, {
9393

9494
connectionStrings: [{
9595
name: "db",
96-
value:
97-
pulumi.all([sqlServer.name, database.name]).apply(([server, db]) =>
96+
value:
97+
pulumi.all([sqlServer.name, database.name]).apply(([server, db]) =>
9898
`Server=tcp:${server}.database.windows.net;initial catalog=${db};user ID=${username};password=${pwd};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;`),
9999
type: "SQLAzure"
100-
}]
100+
}]
101101
});
102102

103-
exports.endpoint = app.defaultSiteHostname.apply(n => `https://${n}`);
103+
exports.endpoint = pulumi.interpolate `https://${app.defaultSiteHostname}`;

azure-ts-arm-template/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ const armDeployment = new azure.core.TemplateDeployment("test-dep", {
7171
});
7272

7373
// Finally, export the allocated storage account name.
74-
export const storageAccountName = armDeployment.outputs.apply(outs => outs["storageAccountName"]);
74+
export const storageAccountName = armDeployment.outputs["storageAccountName"];

cloud-js-containers/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const pulumi = require("@pulumi/pulumi");
12
const cloud = require("@pulumi/cloud-aws");
23

34
let service = new cloud.Service("pulumi-nginx", {
@@ -12,4 +13,4 @@ let service = new cloud.Service("pulumi-nginx", {
1213
});
1314

1415
// export just the hostname property of the container frontend
15-
exports.hostname = service.defaultEndpoint.apply(e => `http://${e.hostname}`);
16+
exports.hostname = pulumi.interpolate `http://${service.defaultEndpoint.hostname}`;

cloud-ts-url-shortener-cache-http/cache.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Cache {
2222
},
2323
});
2424

25-
this.endpoint = this.redis.endpoints.apply(endpoints => endpoints.redis[6379]);
25+
this.endpoint = this.redis.endpoints.redis[6379];
2626
}
2727

2828
public get(key: string): Promise<string> {

cloud-ts-url-shortener-cache-http/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
22

3+
import * as pulumi from "@pulumi/pulumi";
34
import * as cloud from "@pulumi/cloud";
45
import * as cache from "./cache";
56
import * as express from "express";
@@ -131,4 +132,4 @@ function staticRoutes(app: express.Express, path: string, root: string) {
131132
}
132133
}
133134

134-
export let endpointUrl = endpoint.url.apply(u => u + "index.html");
135+
export let endpointUrl = pulumi.interpolate `${endpoint.url}index.html`;

cloud-ts-url-shortener-cache/cache.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Cache {
2323
},
2424
});
2525

26-
let endpoint = this.redis.endpoints.apply(endpoints => endpoints.redis[6379]);
26+
let endpoint = this.redis.endpoints.redis[6379];
2727
this.get = async (key: string) => {
2828
let ep = (await endpoint).get();
2929
console.log(`Getting key '${key}' on Redis@${ep.hostname}:${ep.port}`);

cloud-ts-voting-app/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as cloud from "@pulumi/cloud";
55

66
// Get the password to use for Redis from config.
77
let config = new pulumi.Config();
8-
let redisPassword = config.require("redisPassword");
8+
let redisPassword = config.require("redisPassword");
99
let redisPort = 6379;
1010

1111
// The data layer for the application
@@ -21,7 +21,7 @@ let redisCache = new cloud.Service("voting-app-cache", {
2121
},
2222
});
2323

24-
let redisEndpoint = redisCache.endpoints.apply(endpoints => endpoints.redis[redisPort]);
24+
let redisEndpoint = redisCache.endpoints.redis[redisPort];
2525

2626
// A custom container for the frontend, which is a Python Flask app
2727
// Use the 'build' property to specify a folder that contains a Dockerfile.
@@ -31,10 +31,10 @@ let frontend = new cloud.Service("voting-app-frontend", {
3131
votingAppFrontend: {
3232
build: "./frontend", // path to the folder containing the Dockerfile
3333
memory: 512,
34-
ports: [{ port: 80 }],
35-
environment: {
34+
ports: [{ port: 80 }],
35+
environment: {
3636
// pass the Redis container info in environment variables
37-
"REDIS": redisEndpoint.apply(e => e.hostname),
37+
"REDIS": redisEndpoint.hostname,
3838
"REDIS_PORT": redisEndpoint.apply(e => e.port.toString()),
3939
"REDIS_PWD": redisPassword
4040
}
@@ -43,4 +43,4 @@ let frontend = new cloud.Service("voting-app-frontend", {
4343
});
4444

4545
// Export a variable that will be displayed during 'pulumi up'
46-
export let frontendURL = frontend.endpoints.apply(e => e["votingAppFrontend"][80].hostname);
46+
export let frontendURL = frontend.endpoints["votingAppFrontend"][80].hostname;

f5bigip-ts-ltm-pool/f5bigip-ec2-instance/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ const f5BigIpInstance = new aws.ec2.Instance("bigIp", {
8181
vpcSecurityGroupIds: [firewall.id],
8282
});
8383

84-
export const f5Address = f5BigIpInstance.publicIp.apply(x => `https://${x}:8443`);
84+
export const f5Address = pulumi.interpolate `https://${f5BigIpInstance.publicIp}:8443`;
8585
export const f5PrivateIp = f5BigIpInstance.privateIp;

gcp-js-webserver/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ const computeInstance = new gcp.compute.Instance("instance", {
3535
}, { dependsOn: [computeFirewall] });
3636

3737
exports.instanceName = computeInstance.name;
38-
exports.instanceIP = computeInstance.networkInterfaces.apply(ni => ni[0].accessConfigs[0].natIp);
38+
exports.instanceIP = computeInstance.networkInterfaces[0].accessConfigs[0].natIp;

gcp-ts-gke-hello-world/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const clusterProvider = new k8s.Provider(name, {
6767
const ns = new k8s.core.v1.Namespace(name, {}, { provider: clusterProvider });
6868

6969
// Export the Namespace name
70-
export const namespaceName = ns.metadata.apply(m => m.name);
70+
export const namespaceName = ns.metadata.name;
7171

7272
// Create a NGINX Deployment
7373
const appLabels = { appClass: name };
@@ -102,7 +102,7 @@ const deployment = new k8s.apps.v1.Deployment(name,
102102
);
103103

104104
// Export the Deployment name
105-
export const deploymentName = deployment.metadata.apply(m => m.name);
105+
export const deploymentName = deployment.metadata.name;
106106

107107
// Create a LoadBalancer Service for the NGINX Deployment
108108
const service = new k8s.core.v1.Service(name,
@@ -123,5 +123,5 @@ const service = new k8s.core.v1.Service(name,
123123
);
124124

125125
// Export the Service name and public LoadBalancer endpoint
126-
export const serviceName = service.metadata.apply(m => m.name);
126+
export const serviceName = service.metadata.name;
127127
export const servicePublicIP = service.status.apply(s => s.loadBalancer.ingress[0].ip)

gcp-ts-k8s-ruby-on-rails-postgresql/infra/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ const appDeployment = new k8s.apps.v1.Deployment("rails-deployment", {
4343
},
4444
}, { provider: cluster.provider });
4545
const appService = new k8s.core.v1.Service("rails-service", {
46-
metadata: { labels: appDeployment.metadata.apply(m => m.labels) },
46+
metadata: { labels: appDeployment.metadata.labels },
4747
spec: {
4848
type: "LoadBalancer",
4949
ports: [{ port: appPort, targetPort: appPort }],
50-
selector: appDeployment.spec.apply(spec => spec.template.metadata.labels),
50+
selector: appDeployment.spec.template.metadata.labels,
5151
},
5252
}, { provider: cluster.provider });
5353

5454
// Export the app deployment name so we can easily access it.
55-
export let appName = appDeployment.metadata.apply(m => m.name);
55+
export let appName = appDeployment.metadata.name;
5656

5757
// Export the service's IP address.
5858
export let appAddress = appService.status.apply(s => `http://${s.loadBalancer.ingress[0].ip}:${appPort}`);

0 commit comments

Comments
 (0)