cdk-real-drift 0.12.83 → 0.12.85

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
@@ -10,7 +10,7 @@ import { CloudControlClient, DeleteResourceCommand, GetResourceCommand, GetResou
10
10
  import { homedir } from "node:os";
11
11
  import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelectionStrategy, Toolkit } from "@aws-cdk/toolkit-lib";
12
12
  import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
13
- import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetDefaultCreditSpecificationCommand, GetEbsEncryptionByDefaultCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
13
+ import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetDefaultCreditSpecificationCommand, GetEbsEncryptionByDefaultCommand, GetInstanceMetadataDefaultsCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
14
14
  import { DescribeServicesCommand, ECSClient, ListAccountSettingsCommand, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
15
15
  import { DescribeCertificatesCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
16
16
  import { DescribeParametersCommand, GetParametersCommand, GetServiceSettingCommand, SSMClient } from "@aws-sdk/client-ssm";
@@ -3168,6 +3168,7 @@ const GENERATED_TOPLEVEL_PATHS = {
3168
3168
  "AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupOwnerId", "GroupName"]),
3169
3169
  "AWS::ECS::Service": new Set(["Role"]),
3170
3170
  "AWS::SecretsManager::Secret": new Set(["Name"]),
3171
+ "AWS::ElasticLoadBalancingV2::TargetGroup": new Set(["Name"]),
3171
3172
  "AWS::ApplicationAutoScaling::ScalingPolicy": new Set([
3172
3173
  "ResourceId",
3173
3174
  "ServiceNamespace",
@@ -6571,6 +6572,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6571
6572
  ...knownDef,
6572
6573
  CreditSpecification: { CPUCredits: creditDefault }
6573
6574
  };
6575
+ const imds = opts.accountDefaults?.instanceMetadataDefaults;
6576
+ if (imds !== void 0 && isNestedObject(knownDef.MetadataOptions)) knownDef = {
6577
+ ...knownDef,
6578
+ MetadataOptions: {
6579
+ ...knownDef.MetadataOptions,
6580
+ ...imds
6581
+ }
6582
+ };
6574
6583
  }
6575
6584
  if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup" && declared["TargetType"] === "lambda") knownDef = {
6576
6585
  ...knownDef,
@@ -12710,6 +12719,26 @@ async function fetchRdsDefaultCaIdentifier(region) {
12710
12719
  return;
12711
12720
  }
12712
12721
  }
12722
+ const instanceMetadataDefaultsCache = /* @__PURE__ */ new Map();
12723
+ async function fetchInstanceMetadataDefaults(region) {
12724
+ if (instanceMetadataDefaultsCache.has(region)) return instanceMetadataDefaultsCache.get(region);
12725
+ try {
12726
+ const al = (await new EC2Client({
12727
+ region,
12728
+ ...READ_RETRY
12729
+ }).send(new GetInstanceMetadataDefaultsCommand({}))).AccountLevel;
12730
+ const out = {};
12731
+ if (al?.HttpTokens != null) out.HttpTokens = al.HttpTokens;
12732
+ if (al?.HttpPutResponseHopLimit != null) out.HttpPutResponseHopLimit = al.HttpPutResponseHopLimit;
12733
+ if (al?.HttpEndpoint != null) out.HttpEndpoint = al.HttpEndpoint;
12734
+ if (al?.InstanceMetadataTags != null) out.InstanceMetadataTags = al.InstanceMetadataTags;
12735
+ const value = Object.keys(out).length > 0 ? out : void 0;
12736
+ instanceMetadataDefaultsCache.set(region, value);
12737
+ return value;
12738
+ } catch {
12739
+ return;
12740
+ }
12741
+ }
12713
12742
  const kmsDeniedWarned = /* @__PURE__ */ new Set();
12714
12743
  const kmsTransientWarned = /* @__PURE__ */ new Set();
12715
12744
  const POOL_SIZE = 6;
@@ -13315,6 +13344,10 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
13315
13344
  }
13316
13345
  if (Object.keys(map).length > 0) accountDefaults.ec2FamilyCreditDefaults = map;
13317
13346
  }
13347
+ if (desired.resources.some((r) => r.resourceType === "AWS::EC2::Instance")) {
13348
+ const v = await fetchInstanceMetadataDefaults(region);
13349
+ if (v !== void 0) accountDefaults.instanceMetadataDefaults = v;
13350
+ }
13318
13351
  if (desired.resources.some((r) => r.resourceType === "AWS::RDS::DBInstance" || r.resourceType === "AWS::DocDB::DBInstance")) {
13319
13352
  const v = await fetchRdsDefaultCaIdentifier(region);
13320
13353
  if (v !== void 0) accountDefaults.rdsDefaultCaIdentifier = v;