(efs): enableAutomaticBackups property of FileSystem is always treated as if it is true #29881
Labels
@aws-cdk/aws-efs
Related to Amazon Elastic File System
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p3
Describe the bug
The
enableAutomaticBackups
property of props forefs.FileSystem
is documented to befalse
by default, yet the apparent behavior is that it is always true, whether omitting the property or when setting it explicitly tofalse
.Expected Behavior
Invoking
new efs.FileSystem
without settingenableAutomaticBackups
in the props or setting it tofalse
should create an EFS file system without an enabled backup policy.Current Behavior
When the
enableAutomaticBackups
property of props forefs.FileSystem
is set tofalse
or leftundefined
, thebackupPolicy
of the underlying CfnFileSystem construct is left undefined. This leads to the omitting theBackupPolicy
property from the AWS::EFS::FileSystem resource in the generated CloudFormation template, as one might expect. However, experimentation seems to indicate that omittingBackupPolicy
from the template results in an EFS file system that has an enabled backup policy. The end result is that an EFS volume created withefs.FileSystem
always has an enabled backup policy.Adding
BackupPolicy: {Status: "DISABLED"}
to the template does remove the backup policy, which can be achieved by setting the corresponding property in the CfnFileSystem construct.Reproduction Steps
Possible Solution
Change
efs-file-system.ts
where it says:to:
The above proposed changed is not, strictly speaking, a backwards compatible change, so more complex logic may be appropriate to omit the property when
props.enableAutomaticBackups === undefined
.Additional Information/Context
In the reproduction sample, appending:
is a workaround.
CDK CLI Version
2.137.0 (build bb90b4c)
Framework Version
No response
Node.js Version
20.11.1
OS
Ubuntu 22.04
Language
TypeScript
Language Version
TypeScript (5.3.3)
Other information
No response
The text was updated successfully, but these errors were encountered: