cdk-real-drift 0.2.43 → 0.2.44

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/cli.js CHANGED
@@ -29,7 +29,7 @@ import { DescribeDBClustersCommand, DescribeDBInstancesCommand as DescribeDBInst
29
29
  import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
30
30
  import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetTableCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
31
31
  import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
32
- import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
32
+ import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
33
33
  import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
34
34
  import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
35
35
  import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$1, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
@@ -4139,6 +4139,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4139
4139
  live.Policies = live.Policies.filter((p) => !(p && typeof p === "object" && names.has(p.PolicyName)));
4140
4140
  }
4141
4141
  let knownDef = KNOWN_DEFAULTS[resourceType] ?? {};
4142
+ if (resourceType === "AWS::IAM::AccessKey") knownDef = {
4143
+ ...knownDef,
4144
+ Status: "Active"
4145
+ };
4142
4146
  if (resourceType === "AWS::Redshift::Cluster" && typeof declaredIn?.["NodeType"] === "string" && declaredIn["NodeType"].startsWith("ra3")) knownDef = {
4143
4147
  ...knownDef,
4144
4148
  Encrypted: true,
@@ -6584,6 +6588,19 @@ const readIamPolicy = async ({ declared, region }) => {
6584
6588
  ...role ? { Roles: declared.Roles } : user ? { Users: declared.Users } : { Groups: declared.Groups }
6585
6589
  };
6586
6590
  };
6591
+ const readIamAccessKey = async ({ declared, physicalId, region }) => {
6592
+ const userName = str$1(declared.UserName);
6593
+ if (!userName) return void 0;
6594
+ const meta = ((await new IAMClient({
6595
+ region,
6596
+ ...READ_RETRY
6597
+ }).send(new ListAccessKeysCommand({ UserName: userName }))).AccessKeyMetadata ?? []).find((m) => m.AccessKeyId === physicalId);
6598
+ if (!meta) return void 0;
6599
+ return {
6600
+ UserName: userName,
6601
+ Status: meta.Status
6602
+ };
6603
+ };
6587
6604
  const readIamManagedPolicy = async ({ physicalId, region }) => {
6588
6605
  if (!physicalId.startsWith("arn:")) return void 0;
6589
6606
  const c = new IAMClient({
@@ -7683,6 +7700,7 @@ const SDK_OVERRIDES = {
7683
7700
  "AWS::SQS::QueuePolicy": readSqsQueuePolicy,
7684
7701
  "AWS::IAM::Policy": readIamPolicy,
7685
7702
  "AWS::IAM::ManagedPolicy": readIamManagedPolicy,
7703
+ "AWS::IAM::AccessKey": readIamAccessKey,
7686
7704
  "AWS::Lambda::Permission": readLambdaPermission,
7687
7705
  "AWS::Budgets::Budget": readBudget,
7688
7706
  "AWS::EC2::EIP": readEc2Eip,
@@ -8541,7 +8559,27 @@ async function isManagedBySiblingStack(cfn, c, cache) {
8541
8559
  if (cached !== void 0) return cached;
8542
8560
  let managed = false;
8543
8561
  try {
8544
- managed = ((await cfn.send(new DescribeStackResourcesCommand({ PhysicalResourceId: physicalId }))).StackResources ?? []).some((r) => r.PhysicalResourceId === physicalId && r.ResourceType === c.resourceType);
8562
+ const res = await cfn.send(new DescribeStackResourcesCommand({ PhysicalResourceId: physicalId }));
8563
+ const owns = (rs) => rs.some((r) => r.PhysicalResourceId === physicalId && r.ResourceType === c.resourceType);
8564
+ const first = res.StackResources ?? [];
8565
+ if (owns(first)) managed = true;
8566
+ else {
8567
+ const stackName = first[0]?.StackName;
8568
+ if (stackName) {
8569
+ let next;
8570
+ do {
8571
+ const page = await cfn.send(new ListStackResourcesCommand({
8572
+ StackName: stackName,
8573
+ NextToken: next
8574
+ }));
8575
+ if (owns(page.StackResourceSummaries ?? [])) {
8576
+ managed = true;
8577
+ break;
8578
+ }
8579
+ next = page.NextToken;
8580
+ } while (next);
8581
+ }
8582
+ }
8545
8583
  } catch {
8546
8584
  managed = false;
8547
8585
  }