cdk-real-drift 0.12.97 → 0.12.99

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/README.md CHANGED
@@ -288,8 +288,10 @@ needs `--remove-unrecorded`).
288
288
  - **AppSync**: data sources, resolvers, functions
289
289
  - **CloudWatch Logs**: metric filters, subscription filters
290
290
  - **ELBv2**: listeners, listener rules
291
- - **EC2**: VPC subnets, VPC endpoints, VPC route tables, VPC network ACLs, route
292
- table routes
291
+ - **EC2**: VPC subnets, VPC endpoints, VPC route tables, VPC network ACLs, VPC
292
+ security groups (an out-of-band `create-security-group` — a rogue firewall in a
293
+ declared VPC; the VPC default SG and AWS-service-created SGs, e.g. an EKS cluster
294
+ SG, are folded so only a user-created group surfaces), route table routes
293
295
  - **ECS**: cluster services
294
296
  - **KMS**: key aliases, key grants (an out-of-band `kms create-grant` on a key —
295
297
  grants are not a CloudFormation type, so cdkrd surfaces them as a synthetic
@@ -1020,7 +1022,9 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
1020
1022
  - `AWS::EC2::VPC` + `AWS::EC2::RouteTable`: `ec2:DescribeSubnets`,
1021
1023
  `ec2:DescribeRouteTables` (plus `ec2:DescribeInternetGateways` and
1022
1024
  `ec2:DescribeVpcs` for the VPC's out-of-band IGW attachment and secondary
1023
- CIDR sub-resources)
1025
+ CIDR sub-resources, and `ec2:DescribeSecurityGroups` for a VPC's out-of-band
1026
+ security groups — a rogue `AWS::EC2::SecurityGroup`; the default SG and
1027
+ AWS-service-created SGs are folded)
1024
1028
  - `AWS::EC2::NetworkAcl`: `ec2:DescribeNetworkAcls` (enumerates a declared
1025
1029
  NACL's out-of-band entries — a rogue `AWS::EC2::NetworkAclEntry`)
1026
1030
  - `AWS::ECS::Cluster`: `ecs:ListServices` (distinct from the
package/dist/cli.js CHANGED
@@ -2706,8 +2706,11 @@ const KNOWN_DEFAULTS = {
2706
2706
  "AWS::RedshiftServerless::Workgroup": {
2707
2707
  Port: 5439,
2708
2708
  TrackName: "current",
2709
- PricePerformanceTarget: { Status: "DISABLED" },
2710
- Workgroup: { PricePerformanceTarget: { Status: "DISABLED" } }
2709
+ PricePerformanceTarget: {
2710
+ Status: "ENABLED",
2711
+ Level: 50
2712
+ },
2713
+ BaseCapacity: -1
2711
2714
  },
2712
2715
  "AWS::Bedrock::Agent": {
2713
2716
  AgentCollaboration: "DISABLED",
@@ -9544,6 +9547,39 @@ function diffVpcCidrBlockChildren(input) {
9544
9547
  }
9545
9548
  return added;
9546
9549
  }
9550
+ function isAwsManagedSecurityGroup(tags) {
9551
+ return (tags ?? []).some((t) => typeof t.Key === "string" && (t.Key.startsWith("aws:") || t.Key.startsWith("kubernetes.io/cluster/")));
9552
+ }
9553
+ function diffVpcSecurityGroupChildren(input) {
9554
+ const declared = new Set(input.declaredSecurityGroupIds);
9555
+ const added = [];
9556
+ for (const g of input.liveSecurityGroups) {
9557
+ if (declared.has(g.id)) continue;
9558
+ added.push({
9559
+ resourceType: "AWS::EC2::SecurityGroup",
9560
+ identifier: g.id,
9561
+ label: g.label ?? g.id,
9562
+ live: { Id: g.id }
9563
+ });
9564
+ }
9565
+ return added;
9566
+ }
9567
+ async function pageSecurityGroups(client, vpcId) {
9568
+ const out = [];
9569
+ let next;
9570
+ do {
9571
+ const res = await client.send(new DescribeSecurityGroupsCommand({
9572
+ Filters: [{
9573
+ Name: "vpc-id",
9574
+ Values: [vpcId]
9575
+ }],
9576
+ NextToken: next
9577
+ }));
9578
+ out.push(...res.SecurityGroups ?? []);
9579
+ next = res.NextToken;
9580
+ } while (next);
9581
+ return out;
9582
+ }
9547
9583
  async function pageSubnets(client, vpcId) {
9548
9584
  const out = [];
9549
9585
  let next;
@@ -9635,12 +9671,14 @@ async function enumerateVpcChildren(ctx) {
9635
9671
  const declaredEndpointIds = [];
9636
9672
  const declaredRouteTableIds = [];
9637
9673
  const declaredNaclIds = [];
9674
+ const declaredSecurityGroupIds = [];
9638
9675
  for (const r of desired.resources) {
9639
9676
  if (!parentRefMatches(r.declared.VpcId, vpcId) || !r.physicalId) continue;
9640
9677
  if (r.resourceType === "AWS::EC2::Subnet") declaredSubnetIds.push(r.physicalId);
9641
9678
  else if (r.resourceType === "AWS::EC2::VPCEndpoint") declaredEndpointIds.push(r.physicalId);
9642
9679
  else if (r.resourceType === "AWS::EC2::RouteTable") declaredRouteTableIds.push(r.physicalId);
9643
9680
  else if (r.resourceType === "AWS::EC2::NetworkAcl") declaredNaclIds.push(r.physicalId);
9681
+ else if (r.resourceType === "AWS::EC2::SecurityGroup") declaredSecurityGroupIds.push(r.physicalId);
9644
9682
  }
9645
9683
  const declaredAssociationIds = [];
9646
9684
  let hasDeclaredIgwAttachment = false;
@@ -9697,6 +9735,10 @@ async function enumerateVpcChildren(ctx) {
9697
9735
  cidr: b.Ipv6CidrBlock
9698
9736
  });
9699
9737
  }
9738
+ const liveSecurityGroups = (await pageSecurityGroups(client, vpcId)).filter((g) => typeof g.GroupId === "string" && g.GroupName !== "default" && !isAwsManagedSecurityGroup(g.Tags)).map((g) => ({
9739
+ id: g.GroupId,
9740
+ label: g.GroupName ?? g.GroupId
9741
+ }));
9700
9742
  return [
9701
9743
  ...diffVpcChildren({
9702
9744
  declaredSubnetIds,
@@ -9727,6 +9769,10 @@ async function enumerateVpcChildren(ctx) {
9727
9769
  vpcId,
9728
9770
  declaredCidrs,
9729
9771
  liveCidrBlocks
9772
+ }),
9773
+ ...diffVpcSecurityGroupChildren({
9774
+ declaredSecurityGroupIds,
9775
+ liveSecurityGroups
9730
9776
  })
9731
9777
  ];
9732
9778
  }
@@ -12558,7 +12604,10 @@ const OVERRIDE_READABLE_WRITEONLY = {
12558
12604
  ],
12559
12605
  "AWS::Lex::Bot": ["BotLocales"]
12560
12606
  };
12561
- const SCHEMA_READONLY_SUPPLEMENTS = { "AWS::NetworkManager::GlobalNetwork": ["/properties/State", "/properties/CreatedAt"] };
12607
+ const SCHEMA_READONLY_SUPPLEMENTS = {
12608
+ "AWS::NetworkManager::GlobalNetwork": ["/properties/State", "/properties/CreatedAt"],
12609
+ "AWS::RedshiftServerless::Workgroup": ["/properties/Workgroup"]
12610
+ };
12562
12611
  function supplementReadOnly(info, resourceType) {
12563
12612
  const supplements = SCHEMA_READONLY_SUPPLEMENTS[resourceType];
12564
12613
  if (!supplements?.length) return info;