Skip to content

Commit 10c47bb

Browse files
fix: updated the serverless-instance.ts example with missing props (#181)
Co-authored-by: Andrea Angiolillo <[email protected]>
1 parent b2c241c commit 10c47bb

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

examples/l1-resources/serverless-instance.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { Construct } from 'constructs';
33
import { CfnServerlessInstance, ServerlessInstanceProviderSettingsProviderName} from 'awscdk-resources-mongodbatlas';
44

55
interface AtlasStackProps {
6+
readonly name: string;
67
readonly projId: string;
78
readonly profile: string;
8-
readonly continuousBackupEnabled: string;
9-
readonly terminationProtectionEnabled: string;
9+
readonly continuousBackupEnabled: boolean;
10+
readonly terminationProtectionEnabled: boolean;
11+
readonly region: string;
1012
}
1113

1214
export class CdkTestingStack extends cdk.Stack {
@@ -16,11 +18,13 @@ export class CdkTestingStack extends cdk.Stack {
1618
const atlasProps = this.getContextProps();
1719

1820
const myServerlessInstance = new CfnServerlessInstance(this, 'MyServerlessInstance', {
21+
name: atlasProps.name,
1922
projectId: atlasProps.projId,
20-
profile: atlasProps.profile,
23+
profile: atlasProps.profile,
2124
continuousBackupEnabled: atlasProps.continuousBackupEnabled,
2225
providerSettings: {
23-
providerName: ServerlessInstanceProviderSettingsProviderName.SERVERLESS
26+
providerName: ServerlessInstanceProviderSettingsProviderName.SERVERLESS,
27+
regionName: atlasProps.region
2428
},
2529
terminationProtectionEnabled: atlasProps.terminationProtectionEnabled
2630
});
@@ -31,17 +35,20 @@ export class CdkTestingStack extends cdk.Stack {
3135
if (!projId){
3236
throw "No context value specified for orgId. Please specify via the cdk context."
3337
}
34-
35-
const profile = this.node.tryGetContext('profile') ?? 'default';
36-
const terminationProtectionEnabled = this.node.tryGetContext('terminationProtectionEnabled');
37-
const continuousBackupEnabled = this.node.tryGetContext('continuousBackupEnabled');
3838

39+
const name = this.node.tryGetContext('name') ?? 'default';
40+
const profile = this.node.tryGetContext('profile') ?? 'default';
41+
const terminationProtectionEnabled = this.node.tryGetContext('terminationProtectionEnabled') ?? false;
42+
const continuousBackupEnabled = this.node.tryGetContext('continuousBackupEnabled') ?? false;
43+
const region = this.node.tryGetContext('region') ?? "EU_WEST_1";
3944

4045
return {
46+
name,
4147
projId,
4248
profile,
4349
terminationProtectionEnabled,
44-
continuousBackupEnabled
50+
continuousBackupEnabled,
51+
region
4552
}
4653
}
4754
}

0 commit comments

Comments
 (0)