Update Google Native examples to the current version
MODIFY
google-native-ts-functions/index.ts
google-native-ts-functions/index.ts
import * as gcloud from "@pulumi/google-native";
import * as pulumi from "@pulumi/pulumi";
-import * as random from "@pulumi/random";
-const config = new pulumi.Config("google-native");
-const project = config.require("project");
-const region = config.require("region");
+const bucket = new gcloud.storage.v1.Bucket("bucket");
-const randomString = new random.RandomString("name", {
- upper: false,
- number: false,
- special: false,
- length: 8,
-});
-
-const bucketName = pulumi.interpolate`bucket-${randomString.result}`;
-const bucket = new gcloud.storage.v1.Bucket("bucket", {
- project: project,
- bucket: bucketName,
- name: bucketName,
-});
-
-const archiveName = "zip";
-const bucketObject = new gcloud.storage.v1.BucketObject(archiveName, {
- object: archiveName,
- name: archiveName,
+const bucketObject = new gcloud.storage.v1.BucketObject("zip", {
bucket: bucket.name,
source: new pulumi.asset.AssetArchive({
".": new pulumi.asset.FileArchive("./pythonfunc"),
}),
});
-const functionName = pulumi.interpolate`func-${randomString.result}`;
const func = new gcloud.cloudfunctions.v1.Function("function-py", {
- projectsId: project,
- locationsId: region,
- functionsId: functionName,
- name: pulumi.interpolate`projects/${project}/locations/${region}/functions/${functionName}`,
sourceArchiveUrl: pulumi.interpolate`gs://${bucket.name}/${bucketObject.name}`,
httpsTrigger: {},
entryPoint: "handler",
@@ -48,9 +23,7 @@ const func = new gcloud.cloudfunctions.v1.Function("function-py", {
});
const invoker = new gcloud.cloudfunctions.v1.FunctionIamPolicy("function-py-iam", {
- projectsId: project,
- locationsId: region,
- functionsId: functionName, // func.name returns the long `projects/foo/locations/bat/functions/buzz` name which doesn't suit here
+ functionId: func.name.apply(name => name.split("/")[name.split("/").length-1]),
bindings: [
{
members: ["allUsers"],

MODIFY
google-native-ts-functions/package.json
google-native-ts-functions/package.json
"@types/express": "^4.16.0"
},
"dependencies": {
- "@pulumi/google-native": "^0.0.1a",
- "@pulumi/pulumi": "^3.0.0a",
- "@pulumi/random": "^4.0.0a"
+ "@pulumi/google-native": "^0.7.0",
+ "@pulumi/pulumi": "^3.0.0"
}
}

MODIFY
google-native-ts-k8s-ruby-on-rails-postgresql/infra/cluster.ts
google-native-ts-k8s-ruby-on-rails-postgresql/infra/cluster.ts
@@ -6,17 +6,12 @@ import * as pulumi from "@pulumi/pulumi";
import { clusterPassword, clusterUsername, project, region} from "./config";
import { db, testDb } from "./db";
-const clusterName = "gke-native";
const cluster = new gcloud.container.v1.Cluster("cluster", {
- projectsId: project,
- locationsId: region,
- clustersId: clusterName,
parent: `projects/${project}/locations/${region}`,
initialClusterVersion: "1.18.16-gke.2100",
- initialNodeCount: 1,
- name: clusterName,
network: `projects/${project}/global/networks/default`,
- nodeConfig: {
+ nodePools: [{
+ config: {
oauthScopes: [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
@@ -27,6 +22,12 @@ const cluster = new gcloud.container.v1.Cluster("cluster", {
"https://www.googleapis.com/auth/compute",
],
},
+ initialNodeCount: 1,
+ management: {
+ autoRepair: false,
+ },
+ name: "initial",
+ }],
}, {dependsOn: [db, testDb]});
// Uncomment the following to create a custom nodepool instead of

MODIFY
google-native-ts-k8s-ruby-on-rails-postgresql/infra/db.ts
google-native-ts-k8s-ruby-on-rails-postgresql/infra/db.ts
@@ -6,20 +6,10 @@ import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
import { dbPassword, dbUsername, project } from "./config";
-const randomSuffix = new random.RandomString("name", {
- upper: false,
- number: false,
- special: false,
- length: 8,
-});
-
// Provision a database for our Rails app.
-const instanceName = pulumi.interpolate `pgdb-${randomSuffix.result}`;
export const instance = new gcloud.sqladmin.v1beta4.Instance("web-db", {
databaseVersion: "POSTGRES_9_6",
project: project,
- name: instanceName,
- instance: instanceName,
settings: {
tier: "db-f1-micro",
ipConfiguration: {
@@ -31,7 +21,6 @@ export const instance = new gcloud.sqladmin.v1beta4.Instance("web-db", {
const dbName = "app_development";
export const db = new gcloud.sqladmin.v1beta4.Database("db", {
name: dbName,
- database: dbName,
instance: instance.name,
project: project,
});
@@ -39,7 +28,6 @@ export const db = new gcloud.sqladmin.v1beta4.Database("db", {
const testDbName = "app_test";
export const testDb = new gcloud.sqladmin.v1beta4.Database("testdb", {
name: testDbName,
- database: testDbName,
instance: instance.name,
project: project,
}, {dependsOn: [db]}); // only create one db at a time.

MODIFY
google-native-ts-k8s-ruby-on-rails-postgresql/infra/package.json
google-native-ts-k8s-ruby-on-rails-postgresql/infra/package.json
"@types/node": "^8.0.0"
},
"dependencies": {
- "@pulumi/docker": "^2.0.0",
+ "@pulumi/docker": "^3.0.0",
"@pulumi/gcp": "^4.21.0",
- "@pulumi/google-native": "^0.1.0",
- "@pulumi/kubernetes": "^2.0.0",
+ "@pulumi/google-native": "^0.7.0",
+ "@pulumi/kubernetes": "^3.0.0",
"@pulumi/pulumi": "^3.0.0",
- "@pulumi/random": "^3.2.0"
+ "@pulumi/random": "^4.0.0"
}
}

Update Google Native examples to the current version (#1058)