@pattform/api-kit 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ export interface AppComponentArgs {
24
24
  manageValidationRecord?: boolean;
25
25
  githubToken?: pulumi.Input<string>;
26
26
  cloudflareApiToken?: pulumi.Input<string>;
27
+ zoneId?: pulumi.Input<string>;
27
28
  }
28
29
  export interface DnsRecordInstruction {
29
30
  name: string;
@@ -151,11 +151,15 @@ class AppComponent extends pulumi.ComponentResource {
151
151
  const cloudFlareProvider = new cloudflare.Provider(`pattform-app-cloudflare-${appName}-${env}`, {
152
152
  apiToken: cloudFrontToken,
153
153
  });
154
- const cloudflareZone = cloudflare.getZoneOutput({
155
- name: args.domain
156
- }, {
157
- provider: cloudFlareProvider,
158
- });
154
+ // A zone created in the same program (args.zoneId) can't be looked
155
+ // up by name yet, so its id is passed in instead.
156
+ const cloudflareZone = args.zoneId
157
+ ? { id: pulumi.output(args.zoneId) }
158
+ : cloudflare.getZoneOutput({
159
+ name: args.domain
160
+ }, {
161
+ provider: cloudFlareProvider,
162
+ });
159
163
  // ACM validates domain ownership with one deterministic CNAME per
160
164
  // apex, shared across every cert for that domain. When another
161
165
  // stack already manages the apex (e.g. the apex/www site while this
@@ -22,4 +22,8 @@ export interface ContainerComponentArgs {
22
22
  concurrency?: number;
23
23
  readinessPath?: pulumi.Input<string>;
24
24
  livenessPath?: pulumi.Input<string>;
25
+ gcpProject?: pulumi.Input<string>;
26
+ gcpRegion?: pulumi.Input<string>;
27
+ imageDigest?: pulumi.Input<string>;
28
+ image?: pulumi.Input<string>;
25
29
  }
@@ -9,13 +9,16 @@ const gcp = require("@pulumi/gcp");
9
9
  */
10
10
  class ContainerComponent extends pulumi.ComponentResource {
11
11
  constructor(name, args, opts) {
12
- var _a, _b, _c;
12
+ var _a, _b, _c, _d, _e, _f;
13
13
  super("custom:pattform:ContainerComponent", name, args, opts);
14
+ // Project, region and image digest come from args when given (a
15
+ // capability has no stack config of its own), else from config as
16
+ // before: gcp:project, gcp:region and <project>:imageRef.
14
17
  const gcpConfig = new pulumi.Config("gcp");
15
- const gcpProject = gcpConfig.require("project");
16
- const gcpRegion = gcpConfig.require("region");
18
+ const gcpProject = (_a = args.gcpProject) !== null && _a !== void 0 ? _a : gcpConfig.require("project");
19
+ const gcpRegion = (_b = args.gcpRegion) !== null && _b !== void 0 ? _b : gcpConfig.require("region");
17
20
  const componentConfig = new pulumi.Config();
18
- const imageRefFromConfig = componentConfig.get("imageRef");
21
+ const imageRefFromConfig = (_c = args.imageDigest) !== null && _c !== void 0 ? _c : componentConfig.get("imageRef");
19
22
  // Create an Artifact Registry repository
20
23
  this.repository = new gcp.artifactregistry.Repository("container-component-" + args.imageName + "-repo-" + args.environment, {
21
24
  description: args.environment + " repository for " + args.imageName + " Docker images",
@@ -43,12 +46,14 @@ class ContainerComponent extends pulumi.ComponentResource {
43
46
  });
44
47
  // Form the repository URL
45
48
  const repoUrl = pulumi.concat(gcpRegion, "-docker.pkg.dev/", gcpProject, "/", this.repository.repositoryId);
46
- const imageRef = imageRefFromConfig
47
- ? pulumi.interpolate `${repoUrl}/${args.imageName}@${imageRefFromConfig}`
48
- : pulumi.interpolate `${repoUrl}/${args.imageName}:latest`;
49
+ const imageRef = args.image
50
+ ? pulumi.output(args.image)
51
+ : imageRefFromConfig
52
+ ? pulumi.interpolate `${repoUrl}/${args.imageName}@${imageRefFromConfig}`
53
+ : pulumi.interpolate `${repoUrl}/${args.imageName}:latest`;
49
54
  // Default Spring Boot probe paths (can be overridden via args)
50
- const defaultReadinessPath = (_a = args.readinessPath) !== null && _a !== void 0 ? _a : "/actuator/health/readiness";
51
- const defaultLivenessPath = (_b = args.livenessPath) !== null && _b !== void 0 ? _b : "/actuator/health/liveness";
55
+ const defaultReadinessPath = (_d = args.readinessPath) !== null && _d !== void 0 ? _d : "/actuator/health/readiness";
56
+ const defaultLivenessPath = (_e = args.livenessPath) !== null && _e !== void 0 ? _e : "/actuator/health/liveness";
52
57
  // Create a Cloud Run service for the container image.
53
58
  this.service = new gcp.cloudrunv2.Service("container-component-" + args.imageName + "-service-" + args.environment, {
54
59
  location: gcpRegion,
@@ -56,7 +61,7 @@ class ContainerComponent extends pulumi.ComponentResource {
56
61
  name: args.imageName + "-" + args.environment,
57
62
  invokerIamDisabled: true,
58
63
  template: {
59
- maxInstanceRequestConcurrency: (_c = args.concurrency) !== null && _c !== void 0 ? _c : 30,
64
+ maxInstanceRequestConcurrency: (_f = args.concurrency) !== null && _f !== void 0 ? _f : 30,
60
65
  scaling: {
61
66
  maxInstanceCount: 2
62
67
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pattform/api-kit",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Pulumi infra library for building and deploying an API",
5
5
  "author": "Pattform <contact@pattform.io>",
6
6
  "license": "SEE LICENSE IN LICENSE",