@gradientedge/cdk-utils 8.99.1 → 8.101.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.
@@ -207,6 +207,14 @@ export declare class IamManager {
207
207
  * @param servicePrinicpal
208
208
  */
209
209
  createRoleForLambda(id: string, scope: CommonConstruct, policy: iam.PolicyDocument, servicePrinicpal?: iam.ServicePrincipal): cdk.aws_iam.Role;
210
+ /**
211
+ * @summary Method to create iam statement for appconfig secrets manager integration
212
+ * @param id scoped id of the resource
213
+ * @param scope scope in which this resource is defined
214
+ * @param policy
215
+ * @param servicePrinicpal
216
+ */
217
+ createRoleForAppConfigSecrets(id: string, scope: CommonConstruct, policy: iam.PolicyDocument, servicePrinicpal?: iam.ServicePrincipal): cdk.aws_iam.Role;
210
218
  /**
211
219
  * @summary Method to create iam statement for step function execution
212
220
  * @param id scoped id of the resource
@@ -499,6 +499,24 @@ class IamManager {
499
499
  utils.createCfnOutput(`${id}Name`, scope, role.roleName);
500
500
  return role;
501
501
  }
502
+ /**
503
+ * @summary Method to create iam statement for appconfig secrets manager integration
504
+ * @param id scoped id of the resource
505
+ * @param scope scope in which this resource is defined
506
+ * @param policy
507
+ * @param servicePrinicpal
508
+ */
509
+ createRoleForAppConfigSecrets(id, scope, policy, servicePrinicpal) {
510
+ const role = new iam.Role(scope, `${id}`, {
511
+ assumedBy: servicePrinicpal ?? new iam.ServicePrincipal('appconfig.amazonaws.com'),
512
+ description: `Role for ${id} AppConfig Secrets`,
513
+ inlinePolicies: { policy },
514
+ roleName: `${id}-${scope.props.stage}`,
515
+ });
516
+ utils.createCfnOutput(`${id}Arn`, scope, role.roleArn);
517
+ utils.createCfnOutput(`${id}Name`, scope, role.roleName);
518
+ return role;
519
+ }
502
520
  /**
503
521
  * @summary Method to create iam statement for step function execution
504
522
  * @param id scoped id of the resource
@@ -35,9 +35,9 @@ export declare class SecretsManager {
35
35
  retrieveSecretFromSecretsManager(id: string, scope: CommonConstruct, stackName: string, exportName: string): cdk.aws_secretsmanager.ISecret;
36
36
  /**
37
37
  * @summary Method to resolve secret value from a secret using AWS SDK
38
- * @param scope scope in which this resource is defined
38
+ * @param region the region in which the secret is defined
39
39
  * @param secretId the secret name/ARN
40
40
  * @param secretKey the secret key to resolve the value for
41
41
  */
42
- resolveSecretValue(scope: CommonConstruct, secretId: string, secretKey: string): Promise<any>;
42
+ resolveSecretValue(region: string, secretId: string, secretKey: string): Promise<any>;
43
43
  }
@@ -72,14 +72,14 @@ class SecretsManager {
72
72
  }
73
73
  /**
74
74
  * @summary Method to resolve secret value from a secret using AWS SDK
75
- * @param scope scope in which this resource is defined
75
+ * @param region the region in which the secret is defined
76
76
  * @param secretId the secret name/ARN
77
77
  * @param secretKey the secret key to resolve the value for
78
78
  */
79
- async resolveSecretValue(scope, secretId, secretKey) {
79
+ async resolveSecretValue(region, secretId, secretKey) {
80
80
  const client = new client_secrets_manager_1.SecretsManagerClient({
81
81
  credentials: utils.determineCredentials(),
82
- region: scope.props.region,
82
+ region: region,
83
83
  });
84
84
  const command = new client_secrets_manager_1.GetSecretValueCommand({
85
85
  SecretId: secretId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.99.1",
3
+ "version": "8.101.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -538,6 +538,32 @@ export class IamManager {
538
538
  return role
539
539
  }
540
540
 
541
+ /**
542
+ * @summary Method to create iam statement for appconfig secrets manager integration
543
+ * @param id scoped id of the resource
544
+ * @param scope scope in which this resource is defined
545
+ * @param policy
546
+ * @param servicePrinicpal
547
+ */
548
+ public createRoleForAppConfigSecrets(
549
+ id: string,
550
+ scope: CommonConstruct,
551
+ policy: iam.PolicyDocument,
552
+ servicePrinicpal?: iam.ServicePrincipal
553
+ ) {
554
+ const role = new iam.Role(scope, `${id}`, {
555
+ assumedBy: servicePrinicpal ?? new iam.ServicePrincipal('appconfig.amazonaws.com'),
556
+ description: `Role for ${id} AppConfig Secrets`,
557
+ inlinePolicies: { policy },
558
+ roleName: `${id}-${scope.props.stage}`,
559
+ })
560
+
561
+ utils.createCfnOutput(`${id}Arn`, scope, role.roleArn)
562
+ utils.createCfnOutput(`${id}Name`, scope, role.roleName)
563
+
564
+ return role
565
+ }
566
+
541
567
  /**
542
568
  * @summary Method to create iam statement for step function execution
543
569
  * @param id scoped id of the resource
@@ -56,14 +56,14 @@ export class SecretsManager {
56
56
 
57
57
  /**
58
58
  * @summary Method to resolve secret value from a secret using AWS SDK
59
- * @param scope scope in which this resource is defined
59
+ * @param region the region in which the secret is defined
60
60
  * @param secretId the secret name/ARN
61
61
  * @param secretKey the secret key to resolve the value for
62
62
  */
63
- public async resolveSecretValue(scope: CommonConstruct, secretId: string, secretKey: string) {
63
+ public async resolveSecretValue(region: string, secretId: string, secretKey: string) {
64
64
  const client = new SecretsManagerClient({
65
65
  credentials: utils.determineCredentials(),
66
- region: scope.props.region,
66
+ region: region,
67
67
  })
68
68
  const command = new GetSecretValueCommand({
69
69
  SecretId: secretId,