cdk-real-drift 0.2.43 → 0.2.45

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";
@@ -3168,6 +3168,36 @@ function parseCfnTemplate(text) {
3168
3168
  function parseTemplateBody(body) {
3169
3169
  return parseCfnTemplate(body);
3170
3170
  }
3171
+ function partitionForRegion(region) {
3172
+ if (region.startsWith("us-gov-")) return {
3173
+ partition: "aws-us-gov",
3174
+ urlSuffix: "amazonaws.com"
3175
+ };
3176
+ if (region.startsWith("cn-")) return {
3177
+ partition: "aws-cn",
3178
+ urlSuffix: "amazonaws.com.cn"
3179
+ };
3180
+ if (region.startsWith("us-iso-")) return {
3181
+ partition: "aws-iso",
3182
+ urlSuffix: "c2s.ic.gov"
3183
+ };
3184
+ if (region.startsWith("us-isob-")) return {
3185
+ partition: "aws-iso-b",
3186
+ urlSuffix: "sc2s.sgov.gov"
3187
+ };
3188
+ if (region.startsWith("us-isof-")) return {
3189
+ partition: "aws-iso-f",
3190
+ urlSuffix: "csp.hci.ic.gov"
3191
+ };
3192
+ if (region.startsWith("eu-isoe-")) return {
3193
+ partition: "aws-iso-e",
3194
+ urlSuffix: "cloud.adc-e.uk"
3195
+ };
3196
+ return {
3197
+ partition: "aws",
3198
+ urlSuffix: "amazonaws.com"
3199
+ };
3200
+ }
3171
3201
  function buildResolverContext(template, stackParams, physIds, region, accountId, stackName, stackId) {
3172
3202
  const paramDefs = template.Parameters ?? {};
3173
3203
  const isList = (k) => {
@@ -3185,13 +3215,14 @@ function buildResolverContext(template, stackParams, physIds, region, accountId,
3185
3215
  if (res?.Type) typeOf[lid] = res.Type;
3186
3216
  if (res?.Properties) declaredRawProps[lid] = res.Properties;
3187
3217
  }
3218
+ const { partition, urlSuffix } = partitionForRegion(region);
3188
3219
  return {
3189
3220
  params,
3190
3221
  pseudo: {
3191
3222
  "AWS::Region": region,
3192
3223
  "AWS::AccountId": accountId,
3193
- "AWS::Partition": "aws",
3194
- "AWS::URLSuffix": "amazonaws.com",
3224
+ "AWS::Partition": partition,
3225
+ "AWS::URLSuffix": urlSuffix,
3195
3226
  "AWS::StackName": stackName,
3196
3227
  "AWS::StackId": stackId
3197
3228
  },
@@ -4139,6 +4170,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4139
4170
  live.Policies = live.Policies.filter((p) => !(p && typeof p === "object" && names.has(p.PolicyName)));
4140
4171
  }
4141
4172
  let knownDef = KNOWN_DEFAULTS[resourceType] ?? {};
4173
+ if (resourceType === "AWS::IAM::AccessKey") knownDef = {
4174
+ ...knownDef,
4175
+ Status: "Active"
4176
+ };
4142
4177
  if (resourceType === "AWS::Redshift::Cluster" && typeof declaredIn?.["NodeType"] === "string" && declaredIn["NodeType"].startsWith("ra3")) knownDef = {
4143
4178
  ...knownDef,
4144
4179
  Encrypted: true,
@@ -6584,6 +6619,19 @@ const readIamPolicy = async ({ declared, region }) => {
6584
6619
  ...role ? { Roles: declared.Roles } : user ? { Users: declared.Users } : { Groups: declared.Groups }
6585
6620
  };
6586
6621
  };
6622
+ const readIamAccessKey = async ({ declared, physicalId, region }) => {
6623
+ const userName = str$1(declared.UserName);
6624
+ if (!userName) return void 0;
6625
+ const meta = ((await new IAMClient({
6626
+ region,
6627
+ ...READ_RETRY
6628
+ }).send(new ListAccessKeysCommand({ UserName: userName }))).AccessKeyMetadata ?? []).find((m) => m.AccessKeyId === physicalId);
6629
+ if (!meta) return void 0;
6630
+ return {
6631
+ UserName: userName,
6632
+ Status: meta.Status
6633
+ };
6634
+ };
6587
6635
  const readIamManagedPolicy = async ({ physicalId, region }) => {
6588
6636
  if (!physicalId.startsWith("arn:")) return void 0;
6589
6637
  const c = new IAMClient({
@@ -7683,6 +7731,7 @@ const SDK_OVERRIDES = {
7683
7731
  "AWS::SQS::QueuePolicy": readSqsQueuePolicy,
7684
7732
  "AWS::IAM::Policy": readIamPolicy,
7685
7733
  "AWS::IAM::ManagedPolicy": readIamManagedPolicy,
7734
+ "AWS::IAM::AccessKey": readIamAccessKey,
7686
7735
  "AWS::Lambda::Permission": readLambdaPermission,
7687
7736
  "AWS::Budgets::Budget": readBudget,
7688
7737
  "AWS::EC2::EIP": readEc2Eip,
@@ -8541,7 +8590,27 @@ async function isManagedBySiblingStack(cfn, c, cache) {
8541
8590
  if (cached !== void 0) return cached;
8542
8591
  let managed = false;
8543
8592
  try {
8544
- managed = ((await cfn.send(new DescribeStackResourcesCommand({ PhysicalResourceId: physicalId }))).StackResources ?? []).some((r) => r.PhysicalResourceId === physicalId && r.ResourceType === c.resourceType);
8593
+ const res = await cfn.send(new DescribeStackResourcesCommand({ PhysicalResourceId: physicalId }));
8594
+ const owns = (rs) => rs.some((r) => r.PhysicalResourceId === physicalId && r.ResourceType === c.resourceType);
8595
+ const first = res.StackResources ?? [];
8596
+ if (owns(first)) managed = true;
8597
+ else {
8598
+ const stackName = first[0]?.StackName;
8599
+ if (stackName) {
8600
+ let next;
8601
+ do {
8602
+ const page = await cfn.send(new ListStackResourcesCommand({
8603
+ StackName: stackName,
8604
+ NextToken: next
8605
+ }));
8606
+ if (owns(page.StackResourceSummaries ?? [])) {
8607
+ managed = true;
8608
+ break;
8609
+ }
8610
+ next = page.NextToken;
8611
+ } while (next);
8612
+ }
8613
+ }
8545
8614
  } catch {
8546
8615
  managed = false;
8547
8616
  }