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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 7 additions & 7 deletions
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

Lines changed: 11 additions & 11 deletions
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

Lines changed: 2 additions & 1 deletion
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`;

0 commit comments

Comments
 (0)