@pattform/api-kit 2.5.0 → 2.6.1
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.
package/dist/ApiComponent.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class ApiComponent extends pulumi.ComponentResource {
|
|
|
13
13
|
export interface ApiComponentArgs {
|
|
14
14
|
environment: pulumi.Input<string>;
|
|
15
15
|
imageName: pulumi.Input<string>;
|
|
16
|
+
roleArn?: pulumi.Input<string>;
|
|
16
17
|
containerUrl: pulumi.Input<string>;
|
|
17
18
|
appDomain: pulumi.Input<string>;
|
|
18
19
|
localAppDomain: pulumi.Input<string>;
|
package/dist/ApiComponent.js
CHANGED
|
@@ -10,16 +10,25 @@ const pattformHelper_1 = require("./pattformHelper");
|
|
|
10
10
|
*/
|
|
11
11
|
class ApiComponent extends pulumi.ComponentResource {
|
|
12
12
|
constructor(name, args, opts) {
|
|
13
|
+
var _a;
|
|
13
14
|
super("custom:pattform:ApiComponent", name, args, opts);
|
|
14
15
|
const awsConfig = new pulumi.Config("aws");
|
|
15
16
|
const awsRegion = awsConfig.require("region");
|
|
16
|
-
const awsAccessKey = awsConfig.
|
|
17
|
-
const awsSecretKey = awsConfig.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const awsAccessKey = awsConfig.getSecret("accessKey");
|
|
18
|
+
const awsSecretKey = awsConfig.getSecret("secretKey");
|
|
19
|
+
// Credential precedence matches AppComponent: assume-role into the
|
|
20
|
+
// client account (preferred), then static keys (legacy stacks), then
|
|
21
|
+
// ambient credentials (e.g. an ESC aws-login environment).
|
|
22
|
+
const roleArn = (_a = args.roleArn) !== null && _a !== void 0 ? _a : awsConfig.get("roleArn");
|
|
23
|
+
const awsProvider = new aws.Provider("api-component-aws-" + args.environment, Object.assign(Object.assign({ region: (0, pattformHelper_1.verifyRegion)(awsRegion) }, (awsAccessKey && awsSecretKey ? {
|
|
20
24
|
accessKey: awsAccessKey,
|
|
21
25
|
secretKey: awsSecretKey,
|
|
22
|
-
})
|
|
26
|
+
} : {})), (roleArn ? {
|
|
27
|
+
assumeRole: {
|
|
28
|
+
roleArn: roleArn,
|
|
29
|
+
sessionName: pulumi.interpolate `pattform-api-${args.imageName}-${args.environment}`.apply(s => s.substring(0, 64)),
|
|
30
|
+
},
|
|
31
|
+
} : {})));
|
|
23
32
|
// Create an HTTP API for the load balancer to route to
|
|
24
33
|
this.httpApi = new aws.apigatewayv2.Api("api-component-" + args.imageName + "-api-" + args.environment, {
|
|
25
34
|
name: args.imageName,
|
|
@@ -9,7 +9,7 @@ const gcp = require("@pulumi/gcp");
|
|
|
9
9
|
*/
|
|
10
10
|
class ContainerComponent extends pulumi.ComponentResource {
|
|
11
11
|
constructor(name, args, opts) {
|
|
12
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
13
13
|
super("custom:pattform:ContainerComponent", name, args, opts);
|
|
14
14
|
const gcpConfig = new pulumi.Config("gcp");
|
|
15
15
|
const gcpProject = gcpConfig.require("project");
|
|
@@ -56,7 +56,7 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
56
56
|
name: args.imageName + "-" + args.environment,
|
|
57
57
|
invokerIamDisabled: true,
|
|
58
58
|
template: {
|
|
59
|
-
maxInstanceRequestConcurrency: 30,
|
|
59
|
+
maxInstanceRequestConcurrency: (_c = args.concurrency) !== null && _c !== void 0 ? _c : 30,
|
|
60
60
|
scaling: {
|
|
61
61
|
maxInstanceCount: 2
|
|
62
62
|
},
|
|
@@ -22,6 +22,6 @@ export interface GcpProjectComponentArgs {
|
|
|
22
22
|
services?: string[];
|
|
23
23
|
deployServiceAccountId?: string;
|
|
24
24
|
deployRoles?: string[];
|
|
25
|
-
|
|
25
|
+
tokenCreatorMembers?: pulumi.Input<string>[];
|
|
26
26
|
importProjectId?: string;
|
|
27
27
|
}
|
|
@@ -38,13 +38,14 @@ class GcpProjectComponent extends pulumi.ComponentResource {
|
|
|
38
38
|
member: pulumi.interpolate `serviceAccount:${deploySa.email}`,
|
|
39
39
|
}, { parent: deploySa });
|
|
40
40
|
}
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
// Trust hop, mirroring OrganizationAccountAccessRole on AWS: the base
|
|
42
|
+
// automation identity (pattform-infra, opened via the shared Common
|
|
43
|
+
// gcp-login) may mint tokens for this project's deploy SA. Stacks then
|
|
44
|
+
// set gcp:impersonateServiceAccount to hop in, no per-client ESC auth.
|
|
45
|
+
((_e = args.tokenCreatorMembers) !== null && _e !== void 0 ? _e : []).forEach((member, i) => {
|
|
46
|
+
new gcp.serviceaccount.IAMMember(`${name}-deploy-token-creator-${i}`, {
|
|
46
47
|
serviceAccountId: deploySa.name,
|
|
47
|
-
role: "roles/iam.
|
|
48
|
+
role: "roles/iam.serviceAccountTokenCreator",
|
|
48
49
|
member: member,
|
|
49
50
|
}, { parent: deploySa });
|
|
50
51
|
});
|