Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/infrastructure/lib/components/config/nuke-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ accounts:
- property: RoleName
type: glob
value: aws-controltower-*
IAMServiceLinkedRole:
- type: exact
value: AWSServiceRoleForECS # ECS Service Linked Role
IAMSAMLProvider:
- type: contains
value: AWSSSO
Expand Down
14 changes: 14 additions & 0 deletions source/infrastructure/lib/isb-sandbox-account-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Stack } from "aws-cdk-lib";
import {
AccountPrincipal,
CfnServiceLinkedRole,
Effect,
PolicyDocument,
PolicyStatement,
Expand Down Expand Up @@ -59,5 +60,18 @@ export class IsbSandboxAccountResources {
"IAM_NO_INLINE_POLICY_CHECK",
"IAM_POLICYDOCUMENT_NO_WILDCARD_RESOURCE",
]);

// ECS Service Linked Role
// This ensures ECS clusters can be created without permission issues
const ecsServiceLinkedRole = new CfnServiceLinkedRole(scope, "ECSServiceLinkedRole", {
awsServiceName: "ecs.amazonaws.com",
description: "Role to enable Amazon ECS to manage your cluster.",
});

// Add cfn-guard suppressions using direct metadata approach
// (CfnServiceLinkedRole doesn't support cfnOptions, so we use addMetadata directly)
ecsServiceLinkedRole.addMetadata("guard", {
SuppressedRules: ["CFN_NO_EXPLICIT_RESOURCE_NAMES"],
});
}
}
10 changes: 10 additions & 0 deletions source/infrastructure/test/__snapshots__/snapshots.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19956,6 +19956,9 @@ accounts:
- property: RoleName
type: glob
value: aws-controltower-*
IAMServiceLinkedRole:
- type: exact
value: AWSServiceRoleForECS # ECS Service Linked Role
IAMSAMLProvider:
- type: contains
value: AWSSSO
Expand Down Expand Up @@ -20494,6 +20497,13 @@ exports[`SandboxAccountStack Snapshot > matches the snapshot 1`] = `
},
},
"Resources": {
"ECSServiceLinkedRole": {
"Properties": {
"AWSServiceName": "ecs.amazonaws.com",
"Description": "Role to enable Amazon ECS to manage your cluster.",
},
"Type": "AWS::IAM::ServiceLinkedRole",
},
"SandboxAccountRole39551795": {
"Metadata": {
"guard": {
Expand Down