question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aws-ecs: EFSVolumeConfiguration is an extraneous key

See original GitHub issue

❓ General Issue

The Question

When creating a FargateTaskDefinition and adding an EFS Volume, the CloudFormation template warns that the “EfsVolumeConfiguration” is an extraneous key - is this a known issue?

Given the following Typescript FargateTaskDefinition

    const myAppFargateTaskDefinition = new FargateTaskDefinition(this, 'MyAppFargateTaskDefinition', {
         memoryLimitMiB: 512,
        cpu: 256,
        executionRole: myAppFargateTaskExecutionRole,
        taskRole: myAppFargateTaskRole,
    });

    myAppFargateTaskDefinition.addVolume({
        name: 'MyAppEfsVolume',
        efsVolumeConfiguration: {
            fileSystemId: fileSystem.fileSystemId,
            transitEncryption: 'ENABLED',
            authorizationConfig: {
                accessPointId: fileSystemAccessPoint.accessPointId
            }
        }
    });

The output Cloudformation template generates the following:

    "MyAppFargateTaskDefinitionEB5C71CC": {
          "Type": "AWS::ECS::TaskDefinition",
          "Properties": {
              ...,
              Volumes": [ {
                "Name": "MyAppEfsVolume",
                "EfsVolumeConfiguration": {
                  "AuthorizationConfig": {
                    "AccessPointId": {
                      "Ref": "FileSystemAccessPointF8178182"
                    }
                  },
                  "TransitEncryption": "ENABLED",
                  "FileSystemId": {
                    "Ref": "FileSystem8A8E25C0"
                  }
               }
           }]
       }
    }

However when creating the stack there is the following validation message:

Resource template validation failed for resource MyAppFargateTaskDefinitionEB5C71CC as the template has invalid properties. Please refer to the resource documentation to fix the template. Properties validation failed for resource MyAppFargateTaskDefinitionEB5C71CC with message: #/Volumes/0: extraneous key [EfsVolumeConfiguration] is not permitted

Environment

  • CDK CLI Version: 1.97.0
  • Module Version: 1.97.1
  • Node.js Version: v13.14.0
  • OS: macOs Mojave
  • Language (Version): Typescript (4.2.4)

Other information

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:27 (17 by maintainers)

github_iconTop GitHub Comments

4reactions
alexb-ukcommented, May 7, 2021

If it helps I’m running 1.102.0 and am still seeing the warning in CDK console out:

 1/3 | 12:47:34 | CREATE_IN_PROGRESS   | AWS::ECS::TaskDefinition | TaskDef (TaskDef54694570) Resource template validation failed for resource TaskDef54694570 as the template has invalid properties. Please refer to the resource documentation to fix the template.
Properties validation failed for resource TaskDef54694570 with message:
#/Volumes/0: extraneous key [EfsVolumeConfiguration] is not permitted

Synth template:

"Volumes": [
    {
      "Name": "efs-test",
      "EfsVolumeConfiguration": {
        "FileSystemId": {
          "Ref": "EfsFileSystemXXX"
        }
      }
    },

Stack does go on to deploy with the volume mounted correctly.

Thanks

4reactions
joe-glasgowcommented, Apr 12, 2021

You can cdk synth and manually change and upload the output given. If you cdk synth here and manually change EfsVolumeConfiguration to EFSVolumeConfiguration and try to manually upload that to cloudformation will it work?

Thanks, that did indeed fix this instance however, there is a subsequent casing issue for FileSystemId

with message: #/Volumes/0/EFSVolumeConfiguration: required key [FilesystemId] not found #/Volumes/0/EFSVolumeConfiguration: extraneous key [FileSystemId] is not permitted

Will manually change this too, will try and find the offending code later and PR a fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Properties validation failed with message extraneous key is ...
The fix is to capitalize the first letter, ie use LinuxParameters instead. Note that this applies to nested properties as well, eg ...
Read more >
extraneous key [Key] is not permitted)" error in CloudFormation
I receive the "Model validation failed (#: extraneous key [Key] is not permitted)" error in my stack events. This error occurs when I...
Read more >
AWS::ECS::TaskDefinition - Amazon CloudFormation
The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists of a key and...
Read more >
AWS Fargate with EFS | Chris A James
About a month ago, AWS announced that AWS ECS and Fargate support for AWS EFS File Systems is now generally available. This is...
Read more >
AWS CloudFormation Custom Resource | by Giuseppe Borgese
efsVolumeConfiguration : { fileSystemId: <put your fily system id like this one fs-xxxxxx> } }, ] } CustomResourceFunction: Type: 'AWS::Lambda::Function'
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found