Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(neptune-alpha): multiple cloudwatchLogsExports cannot be set when configuring log retention #28643

Merged
merged 27 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
da91441
fix: logName
badmintoncryer Jan 10, 2024
a6ba118
fix: remove irrevant update
badmintoncryer Jan 10, 2024
a3eaf7f
test: integ test
badmintoncryer Jan 10, 2024
811d19a
feat: add feature flag
badmintoncryer Jan 18, 2024
a7daf85
feat: feature flag
badmintoncryer Jan 18, 2024
78e3a6f
fix: integ test
badmintoncryer Jan 18, 2024
015a758
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 18, 2024
b1218a8
fix: integ test
badmintoncryer Jan 19, 2024
59f0466
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 19, 2024
bfc21d6
Revert "Merge branch 'main' into 26295-logExport"
badmintoncryer Jan 19, 2024
a1e707e
Revert "fix: integ test"
badmintoncryer Jan 19, 2024
9b595cd
Revert "Merge branch 'main' into 26295-logExport"
badmintoncryer Jan 19, 2024
b76c283
Revert "fix: integ test"
badmintoncryer Jan 19, 2024
a06e9aa
Revert "feat: feature flag"
badmintoncryer Jan 19, 2024
b9d99ca
Revert "feat: add feature flag"
badmintoncryer Jan 19, 2024
12249ec
Revert "test: integ test"
badmintoncryer Jan 19, 2024
61402fc
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 19, 2024
3ceba53
fix
badmintoncryer Jan 19, 2024
f66f974
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 23, 2024
82b453b
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 23, 2024
0b0c0b7
Merge branch 'main' into 26295-logExport
paulhcsun Jan 25, 2024
68f4c5c
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 26, 2024
9a3cbb0
Merge branch 'main' into 26295-logExport
paulhcsun Jan 26, 2024
cd32bd5
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
cef5ad3
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
9844c1d
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
3703619
Merge branch 'main' into 26295-logExport
paulhcsun Jan 30, 2024
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
Prev Previous commit
Next Next commit
feat: feature flag
  • Loading branch information
badmintoncryer committed Jan 18, 2024
commit a7daf85d066649b5b22dd1ebdc2e41cb29ee6a7c
16 changes: 10 additions & 6 deletions packages/@aws-cdk/aws-neptune-alpha/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as logs from 'aws-cdk-lib/aws-logs';
import { Aws, Duration, IResource, Lazy, RemovalPolicy, Resource, Token } from 'aws-cdk-lib/core';
import { Aws, Duration, FeatureFlags, IResource, Lazy, RemovalPolicy, Resource, Token } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { Endpoint } from './endpoint';
import { InstanceType } from './instance';
import { CfnDBCluster, CfnDBInstance } from 'aws-cdk-lib/aws-neptune';
import { IClusterParameterGroup, IParameterGroup } from './parameter-group';
import { ISubnetGroup, SubnetGroup } from './subnet-group';
import { NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID } from 'aws-cdk-lib/cx-api';

/**
* Possible Instances Types to use in Neptune cluster
Expand Down Expand Up @@ -633,11 +634,14 @@ export class DatabaseCluster extends DatabaseClusterBase implements IDatabaseClu
const retention = props.cloudwatchLogsRetention;
if (retention) {
props.cloudwatchLogsExports?.forEach(logType => {
new logs.LogRetention(this, `${logType.value}LogRetention`, {
logGroupName: `/aws/neptune/${this.clusterIdentifier}/${logType.value}`,
role: props.cloudwatchLogsRetentionRole,
retention,
});
new logs.LogRetention(
this,
`${FeatureFlags.of(this).isEnabled(NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID) ? logType : logType.value}LogRetention`,
{
logGroupName: `/aws/neptune/${this.clusterIdentifier}/${logType.value}`,
role: props.cloudwatchLogsRetentionRole,
retention,
});
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-neptune-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as logs from 'aws-cdk-lib/aws-logs';
import * as cdk from 'aws-cdk-lib';

import { ClusterParameterGroup, DatabaseCluster, EngineVersion, InstanceType, LogType } from '../lib';
import { NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID } from 'aws-cdk-lib/cx-api';

describe('DatabaseCluster', () => {

Expand Down Expand Up @@ -834,6 +835,7 @@ describe('DatabaseCluster', () => {
test('cloudwatchLogsExports log retention is enabled when configured for multiple logs exports', () => {
// GIVEN
const stack = testStack();
stack.node.setContext(NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID, true);
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as cdk from 'aws-cdk-lib';
import * as integ from '@aws-cdk/integ-tests-alpha';
import { DatabaseCluster, EngineVersion, InstanceType, LogType } from '../lib';
import { ClusterParameterGroup, ParameterGroupFamily } from '../lib/parameter-group';
import { NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID } from 'aws-cdk-lib/cx-api';

/*
* Test creating a cluster without specifying engine version.
Expand All @@ -15,8 +16,8 @@ import { ClusterParameterGroup, ParameterGroupFamily } from '../lib/parameter-gr
*/

const app = new cdk.App();

const stack = new cdk.Stack(app, 'aws-cdk-neptune-integ');
stack.node.setContext(NEPTUNE_ALPHA_USE_LOG_TYPE_IN_LOG_RETENTION_ID, true);

const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2, restrictDefaultSecurityGroup: false });

Expand Down