cdk-real-drift 0.1.11 → 0.2.1
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 +5 -0
- package/dist/cli.js +66 -14
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -599,6 +599,11 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
599
599
|
(supplement an `AWS::MSK::Configuration` with its writeOnly `ServerProperties`
|
|
600
600
|
Kafka blob — an out-of-band `update-configuration` revision is otherwise
|
|
601
601
|
invisible),
|
|
602
|
+
`elasticbeanstalk:DescribeConfigurationSettings` (supplements an
|
|
603
|
+
`AWS::ElasticBeanstalk::Environment` with its writeOnly `OptionSettings` — the
|
|
604
|
+
full resolved option set; an out-of-band console edit to any environment option
|
|
605
|
+
is otherwise invisible, and the service-filled default options fold to
|
|
606
|
+
`atDefault`),
|
|
602
607
|
`servicediscovery:GetNamespace` (reads a Cloud Map
|
|
603
608
|
`HttpNamespace` / `PrivateDnsNamespace` / `PublicDnsNamespace` — incl. the Arn an
|
|
604
609
|
ECS Service Connect namespace `Fn::GetAtt` resolves against)
|
package/dist/cli.js
CHANGED
|
@@ -22,6 +22,7 @@ import { GetPolicyCommand, LambdaClient, ListAliasesCommand as ListAliasesComman
|
|
|
22
22
|
import { DescribeDBInstancesCommand, RDSClient } from "@aws-sdk/client-rds";
|
|
23
23
|
import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient, SetTopicAttributesCommand } from "@aws-sdk/client-sns";
|
|
24
24
|
import { BudgetsClient, DescribeBudgetCommand } from "@aws-sdk/client-budgets";
|
|
25
|
+
import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
25
26
|
import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
|
|
26
27
|
import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
|
|
27
28
|
import { DescribeDBClustersCommand, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
@@ -49,7 +50,6 @@ import { S_BAR, S_BAR_END, S_BAR_START, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED
|
|
|
49
50
|
import pc from "picocolors";
|
|
50
51
|
import { MultiSelectPrompt, Prompt, isCancel as isCancel$1 } from "@clack/core";
|
|
51
52
|
import { CloudFrontClient, GetDistributionConfigCommand, UpdateDistributionCommand } from "@aws-sdk/client-cloudfront";
|
|
52
|
-
import { ElasticBeanstalkClient, UpdateApplicationCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
53
53
|
import { DescribeDomainConfigCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
|
|
54
54
|
import { GetWebACLCommand, UpdateWebACLCommand, WAFV2Client } from "@aws-sdk/client-wafv2";
|
|
55
55
|
import { ConfigServiceClient, DescribeConfigRulesCommand, PutConfigRuleCommand } from "@aws-sdk/client-config-service";
|
|
@@ -1983,7 +1983,7 @@ const EB_OPTION_DEFAULTS = {
|
|
|
1983
1983
|
"aws:elasticbeanstalk:control|RollbackLaunchOnFailure": "false",
|
|
1984
1984
|
"aws:elasticbeanstalk:environment:proxy|ProxyServer": "nginx",
|
|
1985
1985
|
"aws:elasticbeanstalk:environment|LoadBalancerType": "classic",
|
|
1986
|
-
"aws:elasticbeanstalk:
|
|
1986
|
+
"aws:elasticbeanstalk:environment|ServiceRole": "AWSServiceRoleForElasticBeanstalk",
|
|
1987
1987
|
"aws:elasticbeanstalk:healthreporting:system|HealthCheckSuccessThreshold": "Ok",
|
|
1988
1988
|
"aws:elasticbeanstalk:healthreporting:system|SystemType": "enhanced",
|
|
1989
1989
|
"aws:elasticbeanstalk:hostmanager|LogPublicationControl": "false",
|
|
@@ -2009,7 +2009,18 @@ const EB_OPTION_DEFAULTS = {
|
|
|
2009
2009
|
"aws:elb:policies|ConnectionDrainingEnabled": "false",
|
|
2010
2010
|
"aws:elb:policies|ConnectionDrainingTimeout": "20",
|
|
2011
2011
|
"aws:elb:policies|ConnectionSettingIdleTimeout": "60",
|
|
2012
|
-
"aws:rds:dbinstance|HasCoupledDatabase": "false"
|
|
2012
|
+
"aws:rds:dbinstance|HasCoupledDatabase": "false",
|
|
2013
|
+
"aws:elasticbeanstalk:container:python|NumProcesses": "1",
|
|
2014
|
+
"aws:elasticbeanstalk:container:python|NumThreads": "15",
|
|
2015
|
+
"aws:elasticbeanstalk:container:python|WSGIPath": "application",
|
|
2016
|
+
"aws:elasticbeanstalk:application:environment|GRADLE_HOME": "/usr/local/gradle",
|
|
2017
|
+
"aws:elasticbeanstalk:application:environment|M2": "/usr/local/apache-maven/bin",
|
|
2018
|
+
"aws:elasticbeanstalk:application:environment|M2_HOME": "/usr/local/apache-maven",
|
|
2019
|
+
"aws:elasticbeanstalk:container:php:phpini|allow_url_fopen": "On",
|
|
2020
|
+
"aws:elasticbeanstalk:container:php:phpini|display_errors": "Off",
|
|
2021
|
+
"aws:elasticbeanstalk:container:php:phpini|max_execution_time": "60",
|
|
2022
|
+
"aws:elasticbeanstalk:container:php:phpini|memory_limit": "256M",
|
|
2023
|
+
"aws:elasticbeanstalk:container:php:phpini|zlib.output_compression": "Off"
|
|
2013
2024
|
};
|
|
2014
2025
|
const EB_OPTION_DERIVED = {
|
|
2015
2026
|
"aws:autoscaling:asg|MaxSize": {
|
|
@@ -2024,15 +2035,20 @@ const EB_OPTION_DERIVED = {
|
|
|
2024
2035
|
const EB_OPTION_VALUE_INDEPENDENT = new Set([
|
|
2025
2036
|
"aws:autoscaling:launchconfiguration|ImageId",
|
|
2026
2037
|
"aws:autoscaling:launchconfiguration|InstanceType",
|
|
2038
|
+
"aws:autoscaling:launchconfiguration|SecurityGroups",
|
|
2039
|
+
"aws:elb:loadbalancer|SecurityGroups",
|
|
2027
2040
|
"aws:cloudformation:template:parameter|AppSource",
|
|
2028
2041
|
"aws:cloudformation:template:parameter|HooksPkgUrl",
|
|
2029
2042
|
"aws:cloudformation:template:parameter|InstanceTypeFamily",
|
|
2043
|
+
"aws:cloudformation:template:parameter|EnvironmentVariables",
|
|
2030
2044
|
"aws:ec2:instances|InstanceTypes",
|
|
2031
2045
|
"aws:ec2:instances|SupportedArchitectures",
|
|
2046
|
+
"aws:elasticbeanstalk:application:environment|PYTHONPATH",
|
|
2032
2047
|
"aws:elasticbeanstalk:healthreporting:system|ConfigDocument",
|
|
2033
|
-
"aws:
|
|
2048
|
+
"aws:elasticbeanstalk:healthreporting:system|EnhancedHealthAuthEnabled"
|
|
2034
2049
|
]);
|
|
2035
2050
|
function ebOptionSettingTier(namespace, optionName, value, envType) {
|
|
2051
|
+
if (value == null || value === "") return "atDefault";
|
|
2036
2052
|
const key = `${String(namespace)}|${String(optionName)}`;
|
|
2037
2053
|
if (EB_OPTION_VALUE_INDEPENDENT.has(key)) return "atDefault";
|
|
2038
2054
|
const derived = EB_OPTION_DERIVED[key];
|
|
@@ -2650,7 +2666,8 @@ const UNORDERED_OBJECT_ARRAY_PROPS = {
|
|
|
2650
2666
|
"AWS::SecretsManager::Secret": new Set(["ReplicaRegions"]),
|
|
2651
2667
|
"AWS::ElastiCache::CacheCluster": new Set(["LogDeliveryConfigurations"]),
|
|
2652
2668
|
"AWS::ElastiCache::ReplicationGroup": new Set(["LogDeliveryConfigurations"]),
|
|
2653
|
-
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields"])
|
|
2669
|
+
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields"]),
|
|
2670
|
+
"AWS::EC2::PrefixList": new Set(["Entries"])
|
|
2654
2671
|
};
|
|
2655
2672
|
const UNORDERED_NESTED_OBJECT_ARRAY_PATHS = {
|
|
2656
2673
|
"AWS::CloudFront::CachePolicy": new Set(["CachePolicyConfig.ParametersInCacheKeyAndForwardedToOrigin.HeadersConfig.Headers"]),
|
|
@@ -3524,16 +3541,21 @@ const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
|
3524
3541
|
"Users",
|
|
3525
3542
|
"Groups"
|
|
3526
3543
|
]) };
|
|
3527
|
-
const
|
|
3544
|
+
const ebOptionSettingsEntryTier = (entry, liveArray) => {
|
|
3545
|
+
const envEntry = (Array.isArray(liveArray) ? liveArray : []).find((e) => e && e.OptionName === "EnvironmentType");
|
|
3546
|
+
const envType = typeof envEntry?.Value === "string" ? envEntry.Value : "LoadBalanced";
|
|
3547
|
+
return ebOptionSettingTier(entry.Namespace, entry.OptionName, entry.Value, envType);
|
|
3548
|
+
};
|
|
3549
|
+
const ebOptionSettingsSubsetSpec = {
|
|
3528
3550
|
re: /(^|\.)OptionSettings$/,
|
|
3529
3551
|
keyFields: ["Namespace", "OptionName"],
|
|
3530
3552
|
ignoreFields: new Set(["ResourceName"]),
|
|
3531
|
-
entryTier:
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
}
|
|
3553
|
+
entryTier: ebOptionSettingsEntryTier
|
|
3554
|
+
};
|
|
3555
|
+
const COMPOSITE_KEY_SUBSET_PATHS = {
|
|
3556
|
+
"AWS::ElasticBeanstalk::ConfigurationTemplate": ebOptionSettingsSubsetSpec,
|
|
3557
|
+
"AWS::ElasticBeanstalk::Environment": ebOptionSettingsSubsetSpec
|
|
3558
|
+
};
|
|
3537
3559
|
function alignCompositeKeySubset(declared, live, spec) {
|
|
3538
3560
|
if (!Array.isArray(declared) || !Array.isArray(live)) return null;
|
|
3539
3561
|
const keyOf = (e) => {
|
|
@@ -4056,7 +4078,11 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4056
4078
|
resourceType,
|
|
4057
4079
|
path: d.path,
|
|
4058
4080
|
desired: d.stateValue,
|
|
4059
|
-
actual: d.awsValue
|
|
4081
|
+
actual: d.awsValue,
|
|
4082
|
+
...unorderedObjArray ? { wholeArrayRevert: {
|
|
4083
|
+
path: k,
|
|
4084
|
+
value: v
|
|
4085
|
+
} } : {}
|
|
4060
4086
|
});
|
|
4061
4087
|
}
|
|
4062
4088
|
}
|
|
@@ -7413,7 +7439,21 @@ const supplementLexBot = async ({ physicalId, region }) => {
|
|
|
7413
7439
|
return;
|
|
7414
7440
|
}
|
|
7415
7441
|
};
|
|
7442
|
+
const supplementElasticBeanstalkEnvironment = async ({ physicalId, declared, region }) => {
|
|
7443
|
+
const envName = str$1(physicalId);
|
|
7444
|
+
const appName = str$1(declared.ApplicationName);
|
|
7445
|
+
if (!envName || !appName) return void 0;
|
|
7446
|
+
const opts = (await new ElasticBeanstalkClient({
|
|
7447
|
+
region,
|
|
7448
|
+
...READ_RETRY
|
|
7449
|
+
}).send(new DescribeConfigurationSettingsCommand({
|
|
7450
|
+
ApplicationName: appName,
|
|
7451
|
+
EnvironmentName: envName
|
|
7452
|
+
}))).ConfigurationSettings?.[0]?.OptionSettings;
|
|
7453
|
+
return Array.isArray(opts) && opts.length > 0 ? { OptionSettings: opts } : void 0;
|
|
7454
|
+
};
|
|
7416
7455
|
const SDK_SUPPLEMENTS = {
|
|
7456
|
+
"AWS::ElasticBeanstalk::Environment": supplementElasticBeanstalkEnvironment,
|
|
7417
7457
|
"AWS::Lex::Bot": supplementLexBot,
|
|
7418
7458
|
"AWS::MSK::Configuration": supplementMskConfiguration,
|
|
7419
7459
|
"AWS::ElasticLoadBalancingV2::TrustStore": supplementTrustStore,
|
|
@@ -7585,6 +7625,7 @@ async function getSchemaInfo(client, resourceType) {
|
|
|
7585
7625
|
}
|
|
7586
7626
|
const OVERRIDE_READABLE_WRITEONLY = {
|
|
7587
7627
|
"AWS::EC2::LaunchTemplate": ["LaunchTemplateData"],
|
|
7628
|
+
"AWS::ElasticBeanstalk::Environment": ["OptionSettings"],
|
|
7588
7629
|
"AWS::MSK::Configuration": ["ServerProperties"],
|
|
7589
7630
|
"AWS::Cognito::IdentityPool": ["CognitoEvents"],
|
|
7590
7631
|
"AWS::SSM::Parameter": [
|
|
@@ -10055,8 +10096,19 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
10055
10096
|
const itemsByLogical = /* @__PURE__ */ new Map();
|
|
10056
10097
|
const notRevertable = [];
|
|
10057
10098
|
const recorded = baseline?.recorded ?? [];
|
|
10058
|
-
|
|
10099
|
+
const wholeArrayEmitted = /* @__PURE__ */ new Set();
|
|
10100
|
+
for (let f of findings) {
|
|
10059
10101
|
const displayId = f.constructPath ? withinStackPath(f.constructPath, opts.stackName ?? "") : f.logicalId;
|
|
10102
|
+
if (f.tier === "declared" && f.wholeArrayRevert && f.path !== f.wholeArrayRevert.path) {
|
|
10103
|
+
const waKey = `${f.logicalId}\0${f.wholeArrayRevert.path}`;
|
|
10104
|
+
if (wholeArrayEmitted.has(waKey)) continue;
|
|
10105
|
+
wholeArrayEmitted.add(waKey);
|
|
10106
|
+
f = {
|
|
10107
|
+
...f,
|
|
10108
|
+
path: f.wholeArrayRevert.path,
|
|
10109
|
+
desired: f.wholeArrayRevert.value
|
|
10110
|
+
};
|
|
10111
|
+
}
|
|
10060
10112
|
if (f.tier === "deleted") {
|
|
10061
10113
|
notRevertable.push({
|
|
10062
10114
|
displayId,
|