I have a CloudFormation script that has the following:
"Parameters": {
"optionalExistingEFSDrive": {
"Description": "EFS drive to store client content. If left empty a new drive will be created automatically.",
"Type": "String",
"Default": ""
}
},
"Conditions": {
"CreateEFSDrive": { "Fn::Equals": [ { "Ref": "optionalExistingEFSDrive" }, "" ] },
},
"Resources": {
"WebFileSystem": {
"Type": "AWS::EFS::FileSystem",
"Condition": "CreateEFSDrive",
"DeletionPolicy": "Retain",
"Properties": {
"FileSystemTags": [
{
"Key": "Name",
"Value": "WebFileSystem"
}
],
"PerformanceMode": "generalPurpose"
}
},
"WebFileSystemMountTarget1": {
"Type": "AWS::EFS::MountTarget",
"Properties": {
"SubnetId": {
"Ref": "WebFileSystemSubnet1"
},
"SecurityGroups": [
{
"Ref": "WebFileSystemSecurityGroup"
}
],
"FileSystemId": {
"Fn::If": [ "CreateEFSDrive", { "Ref": "WebFileSystem" }, { "Ref": "optionalExistingEFSDrive" } ]
}
}
}
}
Passing in a value for optionalExistingEFSDrive that is the file system id of an existing file system, a new filesystem is created, but the mount target correctly mounts to the provided optionalExistingEFSDrive filesystem.
What am I missing? I don't want to create a new EFS, I want to re-use an existing one.