aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.66k stars 3.92k forks source link

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

Closed aprat84 closed 7 months ago

aprat84 commented 8 months ago

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

CDK version used

1.129.0

pahud commented 8 months ago

This would be awesome! We welcome the pull requests!

github-actions[bot] commented 7 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] commented 7 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.