Skip to content

(cloudfront): Support inline data as KeyValueStore import source #29204

@aprat84

Description

@aprat84

Describe the feature

It would be nice to do something like this:

const store = new cloudfront.KeyValueStore(this, 'KeyValueStore', {
  keyValueStoreName: 'KeyValueStore',
  source: cloudfront.ImportSource.fromInline({
    "data":[
      {
        "key": "key1",
        "value": "value"
      },
      {
        "key": "key2",
        "value": "value"
      }
    ]
  }),
});

Use Case

I'd like to store a hashing key, which don't want to be versioned in git.
It is saved in Systems Manager Parameter Store, and I retrieve it before initializing the stacks, so it is a parameter to the stack which should create the KeyValueStore.

I know I could create a temp JSON file, but this has already been made for Lambda's code, so it could be in here too.
https://github.com/aws/aws-cdk/blob/v2.129.0/packages/aws-cdk-lib/aws-lambda/lib/code.ts#L36
https://github.com/aws/aws-cdk/blob/v2.129.0/packages/aws-cdk-lib/aws-lambda/lib/code.ts#L243

Proposed Solution

Add an InlineImportSource class aswell as an static method ImportSource.fromInline(), as it is done with Lambda code.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

1.129.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudfrontRelated to Amazon CloudFronteffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions