cdk-real-drift 0.18.14 → 0.18.15
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 +72 -12
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -45,7 +45,7 @@ import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, Des
|
|
|
45
45
|
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";
|
|
46
46
|
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$2, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
47
47
|
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
48
|
-
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
48
|
+
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, DisableAlarmActionsCommand, EnableAlarmActionsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
49
49
|
import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
50
50
|
import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
|
|
51
51
|
import { GetJobTemplateCommand, GetQueueCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
@@ -2490,6 +2490,7 @@ const KNOWN_DEFAULTS = {
|
|
|
2490
2490
|
MinimumHealthyPercent: 100
|
|
2491
2491
|
}
|
|
2492
2492
|
},
|
|
2493
|
+
"AWS::AppConfig::ConfigurationProfile": { Type: "AWS.Freeform" },
|
|
2493
2494
|
"AWS::AppSync::GraphQLApi": {
|
|
2494
2495
|
ApiType: "GRAPHQL",
|
|
2495
2496
|
Visibility: "GLOBAL",
|
|
@@ -2613,6 +2614,7 @@ const KNOWN_DEFAULTS = {
|
|
|
2613
2614
|
ClusterSubnetGroupName: "default"
|
|
2614
2615
|
},
|
|
2615
2616
|
"AWS::Redshift::ScheduledAction": { Enable: true },
|
|
2617
|
+
"AWS::EC2::VPCEndpointService": { SupportedIpAddressTypes: ["ipv4"] },
|
|
2616
2618
|
"AWS::EC2::VPCEndpoint": {
|
|
2617
2619
|
IpAddressType: "ipv4",
|
|
2618
2620
|
VpcEndpointType: "Gateway",
|
|
@@ -3839,25 +3841,36 @@ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL = {
|
|
|
3839
3841
|
TCP: {
|
|
3840
3842
|
"stickiness.type": "source_ip",
|
|
3841
3843
|
"deregistration_delay.connection_termination.enabled": "false",
|
|
3842
|
-
"proxy_protocol_v2.enabled": "false"
|
|
3844
|
+
"proxy_protocol_v2.enabled": "false",
|
|
3845
|
+
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3846
|
+
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
3843
3847
|
},
|
|
3844
3848
|
TLS: {
|
|
3845
3849
|
"stickiness.type": "source_ip",
|
|
3846
3850
|
"deregistration_delay.connection_termination.enabled": "false",
|
|
3847
|
-
"proxy_protocol_v2.enabled": "false"
|
|
3851
|
+
"proxy_protocol_v2.enabled": "false",
|
|
3852
|
+
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3853
|
+
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
3848
3854
|
},
|
|
3849
3855
|
UDP: {
|
|
3850
3856
|
"stickiness.type": "source_ip",
|
|
3851
3857
|
"deregistration_delay.connection_termination.enabled": "false",
|
|
3852
|
-
"proxy_protocol_v2.enabled": "false"
|
|
3858
|
+
"proxy_protocol_v2.enabled": "false",
|
|
3859
|
+
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3860
|
+
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
3853
3861
|
},
|
|
3854
3862
|
TCP_UDP: {
|
|
3855
3863
|
"stickiness.type": "source_ip",
|
|
3856
3864
|
"deregistration_delay.connection_termination.enabled": "false",
|
|
3857
|
-
"proxy_protocol_v2.enabled": "false"
|
|
3865
|
+
"proxy_protocol_v2.enabled": "false",
|
|
3866
|
+
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3867
|
+
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
3858
3868
|
}
|
|
3859
3869
|
};
|
|
3860
|
-
const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = {
|
|
3870
|
+
const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = {
|
|
3871
|
+
alb: { "preserve_client_ip.enabled": "true" },
|
|
3872
|
+
ip: { "preserve_client_ip.enabled": "false" }
|
|
3873
|
+
};
|
|
3861
3874
|
const SENTINEL_UNPARSEABLE = Symbol("unparseable");
|
|
3862
3875
|
function deepCompareUnordered(a, b) {
|
|
3863
3876
|
if (a === b) return true;
|
|
@@ -3938,6 +3951,9 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
3938
3951
|
"AWS::Redshift::Cluster": new Set(["ClusterIdentifier"]),
|
|
3939
3952
|
"AWS::DMS::ReplicationInstance": new Set(["ReplicationInstanceIdentifier"]),
|
|
3940
3953
|
"AWS::DMS::ReplicationSubnetGroup": new Set(["ReplicationSubnetGroupIdentifier"]),
|
|
3954
|
+
"AWS::DAX::ParameterGroup": new Set(["ParameterGroupName"]),
|
|
3955
|
+
"AWS::DAX::SubnetGroup": new Set(["SubnetGroupName"]),
|
|
3956
|
+
"AWS::CertificateManager::Certificate": new Set(["DomainName"]),
|
|
3941
3957
|
"AWS::DMS::Endpoint": new Set(["EndpointType", "EndpointIdentifier"]),
|
|
3942
3958
|
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields.*.SingleHeader.Name"]),
|
|
3943
3959
|
"AWS::ElasticLoadBalancing::LoadBalancer": new Set(["Listeners.*.Protocol", "Listeners.*.InstanceProtocol"]),
|
|
@@ -4137,7 +4153,8 @@ function isPropertiesFileEqual(a, b) {
|
|
|
4137
4153
|
}
|
|
4138
4154
|
const CASE_INSENSITIVE_ARRAY_PATHS = {
|
|
4139
4155
|
"AWS::ApiGatewayV2::Api": new Set(["CorsConfiguration.AllowHeaders", "CorsConfiguration.ExposeHeaders"]),
|
|
4140
|
-
"AWS::Lambda::Url": new Set(["Cors.AllowHeaders", "Cors.ExposeHeaders"])
|
|
4156
|
+
"AWS::Lambda::Url": new Set(["Cors.AllowHeaders", "Cors.ExposeHeaders"]),
|
|
4157
|
+
"AWS::CertificateManager::Certificate": new Set(["SubjectAlternativeNames"])
|
|
4141
4158
|
};
|
|
4142
4159
|
function isCaseInsensitiveEqualScalarSet(a, b) {
|
|
4143
4160
|
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
@@ -4473,6 +4490,7 @@ const READGAP_COLLECTION_PATHS = {
|
|
|
4473
4490
|
"AWS::DynamoDB::GlobalTable": new Set(["SSESpecification"]),
|
|
4474
4491
|
"AWS::DynamoDB::Table": new Set(["SSESpecification"]),
|
|
4475
4492
|
"AWS::CertificateManager::Certificate": new Set(["DomainValidationOptions"]),
|
|
4493
|
+
"AWS::Glue::Table": new Set(["OpenTableFormatInput"]),
|
|
4476
4494
|
"AWS::EC2::ClientVpnEndpoint": new Set(["TagSpecifications"]),
|
|
4477
4495
|
"AWS::DMS::Endpoint": new Set([
|
|
4478
4496
|
"DocDbSettings",
|
|
@@ -6260,6 +6278,17 @@ function configRecordingStrategyAtDefault(resourceType, schemaPath, value, live)
|
|
|
6260
6278
|
const useOnly = group.AllSupported === true ? "ALL_SUPPORTED_RESOURCE_TYPES" : Array.isArray(excl) && excl.length > 0 ? "EXCLUSION_BY_RESOURCE_TYPES" : Array.isArray(group.ResourceTypes) && group.ResourceTypes.length > 0 ? "INCLUSION_BY_RESOURCE_TYPES" : void 0;
|
|
6261
6279
|
return useOnly !== void 0 && deepEqual(value, { UseOnly: useOnly });
|
|
6262
6280
|
}
|
|
6281
|
+
function glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, declared) {
|
|
6282
|
+
if (resourceType !== "AWS::Glue::Table") return false;
|
|
6283
|
+
if (schemaPath !== "TableInput.Parameters") return false;
|
|
6284
|
+
const otf = declared.OpenTableFormatInput;
|
|
6285
|
+
if (!isNestedObject(otf) || !("IcebergInput" in otf)) return false;
|
|
6286
|
+
if (!isNestedObject(value)) return false;
|
|
6287
|
+
const params = value;
|
|
6288
|
+
const managed = new Set(["table_type", "metadata_location"]);
|
|
6289
|
+
if (!Object.keys(params).every((k) => managed.has(k))) return false;
|
|
6290
|
+
return params.table_type === "ICEBERG";
|
|
6291
|
+
}
|
|
6263
6292
|
const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
|
|
6264
6293
|
function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
|
|
6265
6294
|
if (resourceType !== "AWS::ElasticLoadBalancing::LoadBalancer" || key !== "Policies") return false;
|
|
@@ -6964,6 +6993,11 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6964
6993
|
...knownDefPaths,
|
|
6965
6994
|
"Artifacts.Name": artifactName
|
|
6966
6995
|
};
|
|
6996
|
+
const envType = declared["Environment"]?.["Type"];
|
|
6997
|
+
if (typeof envType === "string" && envType.endsWith("_LAMBDA_CONTAINER")) knownDef = {
|
|
6998
|
+
...knownDef,
|
|
6999
|
+
TimeoutInMinutes: 15
|
|
7000
|
+
};
|
|
6967
7001
|
}
|
|
6968
7002
|
if (resourceType === "AWS::SecretsManager::RotationSchedule") {
|
|
6969
7003
|
const expr = declared["RotationRules"]?.["ScheduleExpression"];
|
|
@@ -6998,6 +7032,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6998
7032
|
};
|
|
6999
7033
|
}
|
|
7000
7034
|
}
|
|
7035
|
+
if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup") {
|
|
7036
|
+
const proto = declared["Protocol"];
|
|
7037
|
+
if (typeof proto === "string" && (proto === "TCP" || proto === "TLS" || proto === "UDP" || proto === "TCP_UDP") && declared["TargetType"] !== "alb") knownDef = {
|
|
7038
|
+
...knownDef,
|
|
7039
|
+
HealthCheckProtocol: "TCP",
|
|
7040
|
+
HealthCheckTimeoutSeconds: 10
|
|
7041
|
+
};
|
|
7042
|
+
}
|
|
7001
7043
|
if (resourceType === "AWS::ElastiCache::ReplicationGroup" && declared["TransitEncryptionEnabled"] === true) knownDef = {
|
|
7002
7044
|
...knownDef,
|
|
7003
7045
|
TransitEncryptionMode: "required"
|
|
@@ -7168,7 +7210,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7168
7210
|
const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
|
|
7169
7211
|
if (!isObjectForm || /tags$/i.test(parentKey)) return;
|
|
7170
7212
|
}
|
|
7171
|
-
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) && !(schemaPath in knownDefPaths) && (!(schemaPath in (MANAGED_KEY_ALIAS_PATHS[resourceType] ?? {})) || shouldFoldManagedServiceKey(resourceType, schemaPath, value, opts.kmsAliasTargets)) ? "generated" : "undeclared";
|
|
7213
|
+
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) || glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, declared) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) && !(schemaPath in knownDefPaths) && (!(schemaPath in (MANAGED_KEY_ALIAS_PATHS[resourceType] ?? {})) || shouldFoldManagedServiceKey(resourceType, schemaPath, value, opts.kmsAliasTargets)) ? "generated" : "undeclared";
|
|
7172
7214
|
const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
|
|
7173
7215
|
findings.push({
|
|
7174
7216
|
tier,
|
|
@@ -12898,11 +12940,12 @@ const readAcmCertificate = async ({ physicalId, declared, region }) => {
|
|
|
12898
12940
|
const declaredSans = Array.isArray(declared.SubjectAlternativeNames) ? declared.SubjectAlternativeNames.filter((s) => str$1(s) !== void 0) : [];
|
|
12899
12941
|
const declaresSans = declaredSans.length > 0;
|
|
12900
12942
|
let sans = (cert.SubjectAlternativeNames ?? []).filter((s) => str$1(s) !== void 0);
|
|
12901
|
-
const apex = str$1(cert.DomainName);
|
|
12902
|
-
|
|
12943
|
+
const apex = str$1(cert.DomainName)?.toLowerCase();
|
|
12944
|
+
const declaredSansLower = declaredSans.map((s) => s.toLowerCase());
|
|
12945
|
+
if (declaresSans && apex !== void 0 && !declaredSansLower.includes(apex)) {
|
|
12903
12946
|
let dropped = false;
|
|
12904
12947
|
sans = sans.filter((s) => {
|
|
12905
|
-
if (!dropped && s === apex) {
|
|
12948
|
+
if (!dropped && s.toLowerCase() === apex) {
|
|
12906
12949
|
dropped = true;
|
|
12907
12950
|
return false;
|
|
12908
12951
|
}
|
|
@@ -17646,6 +17689,18 @@ const writeLogGroupBearerTokenAuth = async (ctx, ops) => {
|
|
|
17646
17689
|
}));
|
|
17647
17690
|
}
|
|
17648
17691
|
};
|
|
17692
|
+
const writeCompositeAlarmActionsEnabled = async (ctx, ops) => {
|
|
17693
|
+
const name = str(ctx.physicalId) ?? str(ctx.declared["AlarmName"]);
|
|
17694
|
+
if (!name) throw new Error("cannot resolve composite alarm name for ActionsEnabled revert");
|
|
17695
|
+
const c = new CloudWatchClient({
|
|
17696
|
+
region: ctx.region,
|
|
17697
|
+
...CLIENT_TIMEOUTS
|
|
17698
|
+
});
|
|
17699
|
+
for (const op of ops) {
|
|
17700
|
+
const enabled = op.op === "remove" ? true : op.value === true;
|
|
17701
|
+
await c.send(enabled ? new EnableAlarmActionsCommand({ AlarmNames: [name] }) : new DisableAlarmActionsCommand({ AlarmNames: [name] }));
|
|
17702
|
+
}
|
|
17703
|
+
};
|
|
17649
17704
|
const writeCognitoIdentityPoolEvents = async (ctx, ops) => {
|
|
17650
17705
|
const id = str(ctx.physicalId) ?? str(ctx.declared["Id"]);
|
|
17651
17706
|
if (!id) throw new Error("cannot resolve identity pool id for CognitoEvents revert");
|
|
@@ -18589,6 +18644,7 @@ const SDK_WRITERS = {
|
|
|
18589
18644
|
"AWS::Config::ConfigurationRecorder": writeConfigConfigurationRecorder
|
|
18590
18645
|
};
|
|
18591
18646
|
const SDK_PROP_WRITERS = {
|
|
18647
|
+
"AWS::CloudWatch::CompositeAlarm": { ActionsEnabled: writeCompositeAlarmActionsEnabled },
|
|
18592
18648
|
"AWS::Cognito::IdentityPool": { CognitoEvents: writeCognitoIdentityPoolEvents },
|
|
18593
18649
|
"AWS::Config::ConfigRule": { InputParameters: writeConfigRuleInputParameters },
|
|
18594
18650
|
"AWS::KinesisVideo::Stream": { DataRetentionInHours: writeKinesisVideoStreamRetention },
|
|
@@ -18932,7 +18988,11 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
|
18932
18988
|
"AWS::ApiGatewayV2::RouteResponse\0ModelSelectionExpression",
|
|
18933
18989
|
"AWS::ApiGatewayV2::Api\0DisableExecuteApiEndpoint",
|
|
18934
18990
|
"AWS::ApiGatewayV2::Route\0AuthorizationType",
|
|
18935
|
-
"AWS::Kinesis::Stream\0RetentionPeriodHours"
|
|
18991
|
+
"AWS::Kinesis::Stream\0RetentionPeriodHours",
|
|
18992
|
+
"AWS::ECS::Cluster\0ClusterSettings",
|
|
18993
|
+
"AWS::CloudWatch::CompositeAlarm\0ActionsEnabled",
|
|
18994
|
+
"AWS::ApiGateway::RestApi\0ApiKeySourceType",
|
|
18995
|
+
"AWS::Glue::Crawler\0SchemaChangePolicy"
|
|
18936
18996
|
]);
|
|
18937
18997
|
const REVERT_SET_DEFAULT_VALUES = {
|
|
18938
18998
|
"AWS::EC2::Subnet\0EnableDns64": false,
|