Use synchronous data sources.
MODIFY
aws-ts-appsync/iam.ts
aws-ts-appsync/iam.ts
@@ -3,8 +3,7 @@ import * as aws from "@pulumi/aws";
export function createIamRole(name: string, table: aws.dynamodb.Table) {
const role = new aws.iam.Role(`${name}-role`, {
- assumeRolePolicy: pulumi.output(
- aws.iam.getPolicyDocument({
+ assumeRolePolicy: aws.iam.getPolicyDocument({
statements: [{
actions: ["sts:AssumeRole"],
principals: [{
@@ -13,8 +12,7 @@ export function createIamRole(name: string, table: aws.dynamodb.Table) {
}],
effect: "Allow",
}],
- })
- ).apply(r => r.json),
+ }).json,
});
const policy = new aws.iam.Policy(`${name}-policy`, {
@@ -24,7 +22,7 @@ export function createIamRole(name: string, table: aws.dynamodb.Table) {
resources: [arn],
effect: "Allow",
}],
- })).apply(r => r.json),
+ })).json,
});
new aws.iam.RolePolicyAttachment(`${name}-rpa`, {

MODIFY
aws-ts-ruby-on-rails/index.ts
aws-ts-ruby-on-rails/index.ts
@@ -13,7 +13,7 @@ const webSg = new aws.ec2.SecurityGroup("webServerSecurityGroup", {
],
});
-const amiId = pulumi.output(aws.getAmi({
+const amiId = aws.getAmi({
filters: [
{
name: "name",
@@ -26,7 +26,7 @@ const amiId = pulumi.output(aws.getAmi({
],
mostRecent: true,
owners: ["137112412989"],
-}));
+});
const webServer = new aws.ec2.Instance("webServer", {
ami: amiId.id,

MODIFY
aws-ts-stackreference/team/index.ts
aws-ts-stackreference/team/index.ts
@@ -25,7 +25,7 @@ const amiId = aws.getAmi({
{ name: "owner-id", values: ["099720109477"] }, // Ubuntu
{ name: "name", values: ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"] },
],
-}).then(x => x.id);
+}).id;
const instance = new aws.ec2.Instance("tagged", {
ami: amiId,

MODIFY
aws-ts-static-website/index.ts
aws-ts-static-website/index.ts
@@ -96,7 +96,7 @@ if (config.certificateArn === undefined) {
}, { provider: eastRegion });
const domainParts = getDomainAndSubdomain(config.targetDomain);
- const hostedZoneId = aws.route53.getZone({ name: domainParts.parentDomain }).then(zone => zone.id);
+ const hostedZoneId = aws.route53.getZone({ name: domainParts.parentDomain }).id;
/**
* Create a DNS record to prove that we _own_ the domain we're requesting a certificate for.
@@ -225,10 +225,10 @@ function getDomainAndSubdomain(domain: string): { subdomain: string, parentDomai
}
// Creates a new Route53 DNS record pointing the domain to the CloudFront distribution.
-async function createAliasRecord(
- targetDomain: string, distribution: aws.cloudfront.Distribution): Promise<aws.route53.Record> {
+function createAliasRecord(
+ targetDomain: string, distribution: aws.cloudfront.Distribution): aws.route53.Record {
const domainParts = getDomainAndSubdomain(targetDomain);
- const hostedZone = await aws.route53.getZone({ name: domainParts.parentDomain });
+ const hostedZone = aws.route53.getZone({ name: domainParts.parentDomain });
return new aws.route53.Record(
targetDomain,
{

MODIFY
aws-ts-twitter-athena/index.ts
aws-ts-twitter-athena/index.ts
@@ -79,8 +79,8 @@ let handler = eventRule.onEvent("on-timer-event", async() => {
});
// athena setup
-let athena = new aws.athena.Database("tweets_database",
- { name: "tweets_database", bucket: bucket.id, forceDestroy: true }
+let athena = new aws.athena.Database("tweets_database_1",
+ { name: "tweets_database_1", bucket: bucket.id, forceDestroy: true }
);
// Sadly, there isn't support for Athena tables in Terraform.

MODIFY
azure-ts-msi-keyvault-rbac/index.ts
azure-ts-msi-keyvault-rbac/index.ts
@@ -69,16 +69,15 @@ const blob = new azure.storage.ZipBlob("zip", {
content: new pulumi.asset.FileArchive("./webapp/bin/Debug/netcoreapp2.2/publish")
});
-const clientConfig = pulumi.output(azure.core.getClientConfig({}));
-const tenantId = clientConfig.apply(c => c.tenantId);
-
-const currentPrincipal = clientConfig.apply(c =>
- // Currently, only service principal ID is available in the context. If we are provided the principle in the config, then
- // just use it. Otherwise, if logged in with a user, find their ID via Azure CLI.
- // see https://github.com/terraform-providers/terraform-provider-azurerm/issues/3234
- c.servicePrincipalObjectId !== ""
- ? c.servicePrincipalObjectId
- : <string>JSON.parse(execSync("az ad signed-in-user show --query objectId").toString()));
+const clientConfig = azure.core.getClientConfig({});
+const tenantId = clientConfig.tenantId;
+
+// Currently, only service principal ID is available in the context. If we are provided the
+// principle in the config, then just use it. Otherwise, if logged in with a user, find their ID
+// via Azure CLI. see https://github.com/terraform-providers/terraform-provider-azurerm/issues/3234
+const currentPrincipal = clientConfig.servicePrincipalObjectId !== ""
+ ? clientConfig.servicePrincipalObjectId
+ : <string>JSON.parse(execSync("az ad signed-in-user show --query objectId").toString());
// Key Vault to store secrets (e.g. Blob URL with SAS)
const vault = new azure.keyvault.KeyVault("vault", {

MODIFY
azure-ts-webserver-component/webserver.ts
azure-ts-webserver-component/webserver.ts
@@ -65,8 +65,8 @@ export class WebServer extends pulumi.ComponentResource {
// The public IP address is not allocated until the VM is running, so wait for that
// resource to create, and then lookup the IP address again to report its public IP.
const ready = pulumi.all({ _: this.vm.id, name: this.publicIp.name, resourceGroupName: this.publicIp.resourceGroupName });
- return ready.apply(async d => {
- const ip = await azure.network.getPublicIP({ name: d.name, resourceGroupName: d.resourceGroupName });
+ return ready.apply(d => {
+ const ip = azure.network.getPublicIP({ name: d.name, resourceGroupName: d.resourceGroupName });
return ip.ipAddress;
});
}

MODIFY
azure-ts-webserver/index.ts
azure-ts-webserver/index.ts
@@ -74,7 +74,7 @@ nohup python -m SimpleHTTPServer 80 &`,
// resource to create, and then lookup the IP address again to report its public IP.
const done = pulumi.all({ _: vm.id, name: publicIp.name, resourceGroupName: publicIp.resourceGroupName });
-export const ipAddress = done.apply(async d => {
- const ip = await azure.network.getPublicIP({ name: d.name, resourceGroupName: d.resourceGroupName });
+export const ipAddress = done.apply(d => {
+ const ip = azure.network.getPublicIP({ name: d.name, resourceGroupName: d.resourceGroupName });
return ip.ipAddress;
});

MODIFY
cloud-js-twitter-athena/index.js
cloud-js-twitter-athena/index.js
@@ -52,8 +52,8 @@ cloud.timer.interval("twitter-search-timer", { minutes: 2 }, async() => {
});
// athena setup
-let athena = new aws.athena.Database("tweets_database",
- { name: "tweets_database", bucket: bucket.bucket.id, forceDestroy: true }
+let athena = new aws.athena.Database("tweets_database_2",
+ { name: "tweets_database_2", bucket: bucket.bucket.id, forceDestroy: true }
);
// Sadly, there isn't support for Athena tables in Terraform.

MODIFY
kubernetes-ts-multicloud/gke.ts
kubernetes-ts-multicloud/gke.ts
@@ -26,7 +26,7 @@ export class GkeCluster extends pulumi.ComponentResource {
super("examples:kubernetes-ts-multicloud:GkeCluster", name, {}, opts);
// Find the latest engine version.
- const engineVersion = gcp.container.getEngineVersions().then(v => v.latestMasterVersion);
+ const engineVersion = gcp.container.getEngineVersions().latestMasterVersion;
// Generate a strong password for the Kubernetes cluster.
const password = new random.RandomString("password", {

Use synchronous data sources. (#362)