Skip to content

Commit 3d1b2d7

Browse files
author
Sicheng Jia
committed
Use IKeyRef instead of ARN string
1 parent 239da1e commit 3d1b2d7

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

text/0859-organization-centralization-rule.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,17 @@ new OrganizationCentralizationRule(this, 'OrganizationCentralizationRule', {
5454
destinationRegion: 'us-east-1',
5555
destinationLogEncryptionStrategy: LogEncryptionStrategy.CUSTOMER_MANAGED,
5656
destinationLogEncryptionConflictResolutionStrategy: LogEncryptionConflictResolutionStrategy.ALLOW,
57-
destinationLogEncryptionKmsKeyArn: 'arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012',
57+
destinationLogEncryptionKmsKey: kms.Key.fromKeyArn(
58+
this,
59+
'DestinationKey',
60+
'arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012',
61+
),
5862
destinationBackupRegion: 'us-west-2',
59-
destinationBackupKmsKeyArn: 'arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012',
63+
destinationBackupKmsKey: kms.Key.fromKeyArn(
64+
this,
65+
'DestinationBackupKey',
66+
'arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012',
67+
),
6068
});
6169
```
6270

@@ -145,10 +153,6 @@ class OrganizationCentralizationRule extends CentralizationRuleBase implements I
145153

146154
```typescript
147155
interface BaseCentralizationRuleProps {
148-
/**
149-
* The name of the centralization rule.
150-
*/
151-
readonly ruleName: string;
152156
/**
153157
* The list of source regions from which telemetry data should be centralized.
154158
*/
@@ -182,22 +186,22 @@ interface BaseCentralizationRuleProps {
182186
*/
183187
readonly destinationLogEncryptionConflictResolutionStrategy?: LogEncryptionConflictResolutionStrategy;
184188
/**
185-
* KMS Key ARN belonging to the primary destination account and region, to encrypt newly created central log groups in the primary destination.
189+
* KMS IKeyRef belonging to the primary destination account and region, to encrypt newly created central log groups in the primary destination.
186190
* @default - Log groups are encrypted with an AWS_OWNED KMS key.
187191
*/
188-
readonly destinationLogEncryptionKmsKeyArn?: string; // explicitly string and not IKey, since the KMS key may not be from the same account
192+
readonly destinationLogEncryptionKmsKey?: IKeyRef;
189193
/**
190194
* Logs-specific backup destination region within the primary destination account to which log data should be centralized.
191195
* @default - no centralization backup destination region is configured.
192196
*/
193197
readonly destinationBackupRegion?: string;
194198
/**
195-
* KMS Key ARN belonging to the primary destination account and backup region, to encrypt newly created central log groups in the backup destination.
199+
* KMS IKeyRef belonging to the primary destination account and backup region, to encrypt newly created central log groups in the backup destination.
196200
* Only applied when destinationBackupRegion is set.
197201
* If destinationBackupRegion is set, the backup region KMS key must be specified if destinationLogEncryptionStrategy is CUSTOMER_MANAGED.
198202
* @default - backup destination log groups are encrypted with an AWS_OWNED KMS key.
199203
*/
200-
readonly destinationBackupKmsKeyArn?: string; // explicitly string and not IKey, since the KMS key may not be from the same account
204+
readonly destinationBackupKmsKey?: IKeyRef;
201205
}
202206

203207
interface OrganizationCentralizationRuleProps extends BaseCentralizationRuleProps {
@@ -241,10 +245,10 @@ export class Scope {
241245
*
242246
* @param scope The scope string.
243247
*/
244-
public static fromString(scope: string): Scope {
245-
return new Scope(scope);
248+
public static fromString(scopeString: string): Scope {
249+
return new Scope(scopeString);
246250
}
247-
protected constructor(public readonly scope: string) {}
251+
protected constructor(public readonly scopeString: string) {}
248252
}
249253

250254
/**
@@ -321,10 +325,11 @@ Validations:
321325
- `destinationBackupRegion` should be a valid AWS region.
322326
- `destinationBackupRegion` must not be the same as the `destinationRegion`.
323327
- If `destinationLogEncryptionStrategy` is `CUSTOMER_MANAGED`, then
324-
- `destinationLogEncryptionKmsKeyArn` must be provided.
325-
- If destinationBackupRegion is set, then `destinationBackupKmsKeyArn` must also be provided.
328+
- `destinationLogEncryptionKmsKey` must be provided.
329+
- If destinationBackupRegion is set, then `destinationBackupKmsKey` must also be provided.
326330
- `sourceLogGroupSelectionCriteria` must be defined.
327-
- KMS Key ARNs should follow valid ARN format.
331+
- KmsKeyArn and EncryptionConflictResolutionStrategy must not be present when EncryptionStrategy is AWS_OWNED
332+
- Both KmsKeyArn and EncryptionConflictResolutionStrategy are required when EncryptionStrategy is CUSTOMER_MANAGED
328333

329334
### Is this a breaking change?
330335

0 commit comments

Comments
 (0)