@go-to-k/cdkd 0.221.7 → 0.221.8
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { A as withErrorHandling, B as generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
|
|
3
3
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
|
|
4
|
-
import { A as AssetPublisher, B as getLegacyStateBucketName, C as DiffCalculator, D as S3StateBackend, E as LockManager, F as getDockerCmd, G as resolveStateBucketWithDefaultAndSource, H as resolveCaptureObservedState, I as runDockerForeground, J as CFN_TEMPLATE_URL_LIMIT, K as warnDeprecatedNoPrefixCliFlag, L as runDockerStreaming, M as WorkGraph, N as buildDockerImage, O as rebuildClientForBucketRegion, P as formatDockerLoginError, Q as AssemblyReader, R as Synthesizer, S as applyRoleArnIfSet, T as TemplateParser, U as resolveSkipPrefix, V as resolveApp, W as resolveStateBucketWithDefault, X as findLargeInlineResources, Y as MIGRATE_TMP_PREFIX, Z as uploadCfnTemplate, _ as collectInlinePolicyNamesManagedBySiblings, a as withRetry, b as CloudControlProvider, c as extractDeploymentEventError, d as cyan, et as resolveBucketRegion, f as gray, g as IAMRoleProvider, h as yellow, i as withResourceDeadline, j as stringifyValue, k as shouldRetainResource, l as formatResourceLine, m as red, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as green, q as CFN_TEMPLATE_BODY_LIMIT, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as bold, v as ProviderRegistry, w as DagBuilder, x as IntrinsicFunctionResolver, y as findActionableSilentDrops, z as getDefaultStateBucketName } from "./deploy-engine-
|
|
4
|
+
import { A as AssetPublisher, B as getLegacyStateBucketName, C as DiffCalculator, D as S3StateBackend, E as LockManager, F as getDockerCmd, G as resolveStateBucketWithDefaultAndSource, H as resolveCaptureObservedState, I as runDockerForeground, J as CFN_TEMPLATE_URL_LIMIT, K as warnDeprecatedNoPrefixCliFlag, L as runDockerStreaming, M as WorkGraph, N as buildDockerImage, O as rebuildClientForBucketRegion, P as formatDockerLoginError, Q as AssemblyReader, R as Synthesizer, S as applyRoleArnIfSet, T as TemplateParser, U as resolveSkipPrefix, V as resolveApp, W as resolveStateBucketWithDefault, X as findLargeInlineResources, Y as MIGRATE_TMP_PREFIX, Z as uploadCfnTemplate, _ as collectInlinePolicyNamesManagedBySiblings, a as withRetry, b as CloudControlProvider, c as extractDeploymentEventError, d as cyan, et as resolveBucketRegion, f as gray, g as IAMRoleProvider, h as yellow, i as withResourceDeadline, j as stringifyValue, k as shouldRetainResource, l as formatResourceLine, m as red, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as green, q as CFN_TEMPLATE_BODY_LIMIT, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as bold, v as ProviderRegistry, w as DagBuilder, x as IntrinsicFunctionResolver, y as findActionableSilentDrops, z as getDefaultStateBucketName } from "./deploy-engine-DCkhw7i7.js";
|
|
5
5
|
import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
@@ -11,7 +11,7 @@ import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQ
|
|
|
11
11
|
import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
|
|
12
12
|
import { AddPermissionCommand, CreateEventSourceMappingCommand, CreateFunctionCommand, CreateFunctionUrlConfigCommand, DeleteEventSourceMappingCommand, DeleteFunctionCommand, DeleteFunctionConcurrencyCommand, DeleteFunctionUrlConfigCommand, DeleteLayerVersionCommand, GetEventSourceMappingCommand, GetFunctionCommand, GetFunctionConcurrencyCommand, GetFunctionRecursionConfigCommand, GetFunctionUrlConfigCommand, GetLayerVersionByArnCommand, GetPolicyCommand as GetPolicyCommand$1, LambdaClient, ListFunctionsCommand, ListLayersCommand, ListTagsCommand, PublishLayerVersionCommand, PutFunctionConcurrencyCommand, PutFunctionRecursionConfigCommand, RemovePermissionCommand, ResourceNotFoundException, TagResourceCommand as TagResourceCommand$1, UntagResourceCommand as UntagResourceCommand$1, UpdateEventSourceMappingCommand, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, UpdateFunctionUrlConfigCommand, waitUntilFunctionUpdatedV2 } from "@aws-sdk/client-lambda";
|
|
13
13
|
import { AssumeRoleCommand, GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
14
|
-
import { AssociateRouteTableCommand, AttachInternetGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAvailabilityZonesCommand, DescribeInstanceAttributeCommand, DescribeInstanceCreditSpecificationsCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DetachInternetGatewayCommand, DisassociateRouteTableCommand, EC2Client, ModifyInstanceAttributeCommand, ModifyInstanceCreditSpecificationCommand, ModifyInstanceMetadataOptionsCommand, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, MonitorInstancesCommand, ReplaceNetworkAclAssociationCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, TerminateInstancesCommand, UnmonitorInstancesCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
|
|
14
|
+
import { AssociateIamInstanceProfileCommand, AssociateRouteTableCommand, AttachInternetGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAvailabilityZonesCommand, DescribeIamInstanceProfileAssociationsCommand, DescribeInstanceAttributeCommand, DescribeInstanceCreditSpecificationsCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DetachInternetGatewayCommand, DisassociateRouteTableCommand, EC2Client, ModifyInstanceAttributeCommand, ModifyInstanceCreditSpecificationCommand, ModifyInstanceMetadataOptionsCommand, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, MonitorInstancesCommand, ReplaceNetworkAclAssociationCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, TerminateInstancesCommand, UnmonitorInstancesCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
|
|
15
15
|
import { CreateTableCommand, DeleteResourcePolicyCommand, DeleteTableCommand, DescribeContinuousBackupsCommand, DescribeContributorInsightsCommand, DescribeKinesisStreamingDestinationCommand, DescribeTableCommand, DescribeTimeToLiveCommand, DisableKinesisStreamingDestinationCommand, DynamoDBClient, EnableKinesisStreamingDestinationCommand, GetResourcePolicyCommand, ListTablesCommand, ListTagsOfResourceCommand, PutResourcePolicyCommand, ResourceNotFoundException as ResourceNotFoundException$1, TagResourceCommand as TagResourceCommand$2, UntagResourceCommand as UntagResourceCommand$2, UpdateContinuousBackupsCommand, UpdateContributorInsightsCommand, UpdateTableCommand, UpdateTimeToLiveCommand } from "@aws-sdk/client-dynamodb";
|
|
16
16
|
import { CloudFormationClient, CreateChangeSetCommand, DeleteChangeSetCommand, DeleteStackCommand, DescribeChangeSetCommand, DescribeStackEventsCommand, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, ExecuteChangeSetCommand, GetTemplateCommand, UpdateStackCommand, waitUntilChangeSetCreateComplete, waitUntilStackDeleteComplete, waitUntilStackImportComplete, waitUntilStackUpdateComplete } from "@aws-sdk/client-cloudformation";
|
|
17
17
|
import { APIGatewayClient, CreateAuthorizerCommand, CreateDeploymentCommand, CreateResourceCommand, CreateStageCommand, DeleteAuthorizerCommand, DeleteDeploymentCommand, DeleteMethodCommand, DeleteResourceCommand, DeleteStageCommand, GetAccountCommand, GetAuthorizerCommand, GetDeploymentCommand, GetMethodCommand, GetResourceCommand, GetStageCommand, NotFoundException as NotFoundException$1, PutIntegrationCommand, PutIntegrationResponseCommand, PutMethodCommand, PutMethodResponseCommand, TagResourceCommand as TagResourceCommand$3, UntagResourceCommand as UntagResourceCommand$3, UpdateAccountCommand, UpdateAuthorizerCommand, UpdateMethodCommand, UpdateStageCommand } from "@aws-sdk/client-api-gateway";
|
|
@@ -1553,7 +1553,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1553
1553
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1554
1554
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1555
1555
|
function getCdkdVersion() {
|
|
1556
|
-
return "0.221.
|
|
1556
|
+
return "0.221.8";
|
|
1557
1557
|
}
|
|
1558
1558
|
/**
|
|
1559
1559
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -14405,7 +14405,7 @@ var EC2Provider = class {
|
|
|
14405
14405
|
try {
|
|
14406
14406
|
const securityGroupIds = properties["SecurityGroupIds"];
|
|
14407
14407
|
const securityGroups = properties["SecurityGroups"];
|
|
14408
|
-
const iamInstanceProfile = properties["IamInstanceProfile"];
|
|
14408
|
+
const iamInstanceProfile = this.normalizeIamInstanceProfile(properties["IamInstanceProfile"]);
|
|
14409
14409
|
const instance = (await this.ec2Client.send(new RunInstancesCommand({
|
|
14410
14410
|
ImageId: imageId,
|
|
14411
14411
|
InstanceType: instanceType,
|
|
@@ -14417,8 +14417,8 @@ var EC2Provider = class {
|
|
|
14417
14417
|
MinCount: 1,
|
|
14418
14418
|
MaxCount: 1,
|
|
14419
14419
|
IamInstanceProfile: iamInstanceProfile ? {
|
|
14420
|
-
Arn: iamInstanceProfile
|
|
14421
|
-
Name: iamInstanceProfile
|
|
14420
|
+
Arn: iamInstanceProfile.arn,
|
|
14421
|
+
Name: iamInstanceProfile.name
|
|
14422
14422
|
} : void 0,
|
|
14423
14423
|
BlockDeviceMappings: this.buildBlockDeviceMappings(properties),
|
|
14424
14424
|
DisableApiTermination: this.coerceBool(properties["DisableApiTermination"]),
|
|
@@ -14436,6 +14436,7 @@ var EC2Provider = class {
|
|
|
14436
14436
|
client: this.ec2Client,
|
|
14437
14437
|
maxWaitTime: 300
|
|
14438
14438
|
}, { InstanceIds: [instanceId] });
|
|
14439
|
+
if (iamInstanceProfile) await this.ensureIamInstanceProfileAssociated(instanceId, iamInstanceProfile.arn, iamInstanceProfile.name, logicalId);
|
|
14439
14440
|
const runningInstance = (await this.ec2Client.send(new DescribeInstancesCommand({ InstanceIds: [instanceId] }))).Reservations?.[0]?.Instances?.[0];
|
|
14440
14441
|
const attributes = {
|
|
14441
14442
|
InstanceId: instanceId,
|
|
@@ -14465,6 +14466,139 @@ var EC2Provider = class {
|
|
|
14465
14466
|
throw new ProvisioningError(`Failed to create EC2 Instance ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
|
|
14466
14467
|
}
|
|
14467
14468
|
}
|
|
14469
|
+
/**
|
|
14470
|
+
* Normalize the CFn `AWS::EC2::Instance.IamInstanceProfile` property into a
|
|
14471
|
+
* `{ arn?, name? }` pair the `RunInstances` / `AssociateIamInstanceProfile`
|
|
14472
|
+
* SDK inputs accept.
|
|
14473
|
+
*
|
|
14474
|
+
* The CFn-canonical shape is a plain STRING — the instance-profile NAME
|
|
14475
|
+
* (what `instanceProfile.ref` resolves to in CDK). cdkd's intrinsic
|
|
14476
|
+
* resolver hands us that resolved string. For robustness we ALSO accept an
|
|
14477
|
+
* ARN string (classified by the `arn:` prefix) and the `{Arn,Name}` object
|
|
14478
|
+
* shape (defensive for hand-written / SDK-shaped templates). Returns
|
|
14479
|
+
* `undefined` when no profile is requested.
|
|
14480
|
+
*/
|
|
14481
|
+
normalizeIamInstanceProfile(raw) {
|
|
14482
|
+
if (raw == null) return void 0;
|
|
14483
|
+
if (typeof raw === "string") {
|
|
14484
|
+
const value = raw.trim();
|
|
14485
|
+
if (value === "") return void 0;
|
|
14486
|
+
return value.startsWith("arn:") ? { arn: value } : { name: value };
|
|
14487
|
+
}
|
|
14488
|
+
if (typeof raw === "object") {
|
|
14489
|
+
const obj = raw;
|
|
14490
|
+
const arn = typeof obj["Arn"] === "string" ? obj["Arn"] : void 0;
|
|
14491
|
+
const name = typeof obj["Name"] === "string" ? obj["Name"] : void 0;
|
|
14492
|
+
if (!arn && !name) return void 0;
|
|
14493
|
+
const normalized = {};
|
|
14494
|
+
if (arn) normalized.arn = arn;
|
|
14495
|
+
if (name) normalized.name = name;
|
|
14496
|
+
return normalized;
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14499
|
+
/**
|
|
14500
|
+
* Guarantee the requested IAM instance profile is actually associated with
|
|
14501
|
+
* the just-launched instance, closing the fresh-profile propagation race.
|
|
14502
|
+
*
|
|
14503
|
+
* cdkd's fast SDK path creates the `AWS::IAM::InstanceProfile` only ~1s
|
|
14504
|
+
* before `RunInstances`. The instance profile (and the role membership the
|
|
14505
|
+
* `IAMInstanceProfileProvider` attached to it) takes a few seconds to
|
|
14506
|
+
* propagate to EC2's view. `RunInstances` does not synchronously validate
|
|
14507
|
+
* the supplied `IamInstanceProfile` — when the profile is not yet visible it
|
|
14508
|
+
* can launch the instance WITHOUT the profile and return success with no
|
|
14509
|
+
* error. The result is a running instance whose `IamInstanceProfile` is
|
|
14510
|
+
* empty even though the template requested one (the `propagation-races-2`
|
|
14511
|
+
* integ caught exactly this).
|
|
14512
|
+
*
|
|
14513
|
+
* Strategy (always run when a profile was requested):
|
|
14514
|
+
* - `DescribeIamInstanceProfileAssociations` for the instance. Only a
|
|
14515
|
+
* fully `associated` association counts as bound — an `associating`
|
|
14516
|
+
* state may never complete when the profile wasn't visible at launch, so
|
|
14517
|
+
* we do NOT treat it as done; we fall through and poll.
|
|
14518
|
+
* - When no `associated` association exists, call
|
|
14519
|
+
* `AssociateIamInstanceProfile`, retrying through the IAM propagation
|
|
14520
|
+
* window on the `Invalid IAM Instance Profile ...` / `NoSuchEntity` /
|
|
14521
|
+
* `not authorized` / `InvalidParameterValue` signals AWS raises while the
|
|
14522
|
+
* just-created profile is still propagating.
|
|
14523
|
+
* - After associating, POLL `DescribeIamInstanceProfileAssociations` until
|
|
14524
|
+
* the association reaches `associated` (bounded) so the profile is
|
|
14525
|
+
* genuinely bound by the time `createInstance` returns — the verify.sh
|
|
14526
|
+
* `describe-instances .IamInstanceProfile` check sees it immediately.
|
|
14527
|
+
* This mirrors the settle CloudFormation gets for free via its latency.
|
|
14528
|
+
*/
|
|
14529
|
+
async ensureIamInstanceProfileAssociated(instanceId, arn, name, logicalId) {
|
|
14530
|
+
if (!arn && !name) return;
|
|
14531
|
+
if (await this.isInstanceProfileAssociated(instanceId)) {
|
|
14532
|
+
this.logger.debug(`IAM instance profile already associated with instance ${instanceId} (${logicalId})`);
|
|
14533
|
+
return;
|
|
14534
|
+
}
|
|
14535
|
+
this.logger.debug(`IAM instance profile not bound at launch for instance ${instanceId} (${logicalId}); associating ${arn ?? name} explicitly`);
|
|
14536
|
+
const maxAttempts = 10;
|
|
14537
|
+
let associated = false;
|
|
14538
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) try {
|
|
14539
|
+
await this.ec2Client.send(new AssociateIamInstanceProfileCommand({
|
|
14540
|
+
InstanceId: instanceId,
|
|
14541
|
+
IamInstanceProfile: {
|
|
14542
|
+
Arn: arn,
|
|
14543
|
+
Name: name
|
|
14544
|
+
}
|
|
14545
|
+
}));
|
|
14546
|
+
this.logger.debug(`AssociateIamInstanceProfile issued for instance ${instanceId} (${logicalId}) on attempt ${attempt}`);
|
|
14547
|
+
associated = true;
|
|
14548
|
+
break;
|
|
14549
|
+
} catch (error) {
|
|
14550
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
14551
|
+
if (msg.includes("IncorrectState") || msg.includes("already associated")) {
|
|
14552
|
+
this.logger.debug(`IAM instance profile already associated with instance ${instanceId} (${logicalId})`);
|
|
14553
|
+
associated = true;
|
|
14554
|
+
break;
|
|
14555
|
+
}
|
|
14556
|
+
if (this.isInstanceProfilePropagationError(msg) && attempt < maxAttempts) {
|
|
14557
|
+
this.logger.debug(`IAM instance profile not yet propagated for instance ${instanceId} (associate attempt ${attempt}/${maxAttempts}: ${msg}), retrying in ${attempt}s...`);
|
|
14558
|
+
await this.sleep(attempt * 1e3);
|
|
14559
|
+
continue;
|
|
14560
|
+
}
|
|
14561
|
+
throw error;
|
|
14562
|
+
}
|
|
14563
|
+
if (!associated) return;
|
|
14564
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
14565
|
+
if (await this.isInstanceProfileAssociated(instanceId)) {
|
|
14566
|
+
this.logger.debug(`IAM instance profile is now associated with instance ${instanceId} (${logicalId})`);
|
|
14567
|
+
return;
|
|
14568
|
+
}
|
|
14569
|
+
if (attempt < maxAttempts) {
|
|
14570
|
+
this.logger.debug(`Waiting for IAM instance profile association to reach 'associated' for instance ${instanceId} (${logicalId}) (poll ${attempt}/${maxAttempts})...`);
|
|
14571
|
+
await this.sleep(attempt * 1e3);
|
|
14572
|
+
}
|
|
14573
|
+
}
|
|
14574
|
+
this.logger.warn(`IAM instance profile association for instance ${instanceId} (${logicalId}) did not reach 'associated' within the propagation window; the instance may still be missing its profile`);
|
|
14575
|
+
}
|
|
14576
|
+
/**
|
|
14577
|
+
* True iff the instance currently has a fully-`associated` IAM instance
|
|
14578
|
+
* profile association. An `associating` state is intentionally NOT counted —
|
|
14579
|
+
* a launch-time association that never completes can sit in `associating`
|
|
14580
|
+
* forever, so the caller must poll for the terminal `associated` state.
|
|
14581
|
+
* A describe failure is treated as "not yet associated" so the caller falls
|
|
14582
|
+
* through to the associate/poll path (the real fix), not a false positive.
|
|
14583
|
+
*/
|
|
14584
|
+
async isInstanceProfileAssociated(instanceId) {
|
|
14585
|
+
try {
|
|
14586
|
+
return (await this.ec2Client.send(new DescribeIamInstanceProfileAssociationsCommand({ Filters: [{
|
|
14587
|
+
Name: "instance-id",
|
|
14588
|
+
Values: [instanceId]
|
|
14589
|
+
}] }))).IamInstanceProfileAssociations?.some((a) => a.State === "associated") ?? false;
|
|
14590
|
+
} catch (err) {
|
|
14591
|
+
this.logger.debug(`DescribeIamInstanceProfileAssociations failed for ${instanceId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
14592
|
+
return false;
|
|
14593
|
+
}
|
|
14594
|
+
}
|
|
14595
|
+
/**
|
|
14596
|
+
* Classify an AssociateIamInstanceProfile error as a fresh-profile
|
|
14597
|
+
* propagation signal worth retrying (vs a hard failure to surface).
|
|
14598
|
+
*/
|
|
14599
|
+
isInstanceProfilePropagationError(msg) {
|
|
14600
|
+
return msg.includes("Invalid IAM Instance Profile") || msg.includes("NoSuchEntity") || msg.includes("not authorized") || msg.includes("InvalidParameterValue") && msg.includes("instance profile");
|
|
14601
|
+
}
|
|
14468
14602
|
async updateInstance(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
14469
14603
|
this.logger.debug(`Updating EC2 Instance ${logicalId}: ${physicalId}`);
|
|
14470
14604
|
try {
|
|
@@ -53879,7 +54013,7 @@ function reorderArgs(argv) {
|
|
|
53879
54013
|
async function main() {
|
|
53880
54014
|
installPipeCloseHandler();
|
|
53881
54015
|
const program = new Command();
|
|
53882
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.
|
|
54016
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.221.8");
|
|
53883
54017
|
program.addCommand(createBootstrapCommand());
|
|
53884
54018
|
program.addCommand(createSynthCommand());
|
|
53885
54019
|
program.addCommand(createListCommand());
|