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.

ssm.StringListParameter does not have version parameter

See original GitHub issue

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository’s issues are intended for feature requests and bug reports.

  • I’m submitting a …

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior? If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce

At the moment StringListParameter class has fromStringListParameterName parameter is rendered using CfnDynamicReference

As a result ssm.StringListParameter.string_list_value creates AWS Cloudformation code block like this:

            {
              "Fn::Split": [
                ",",
                "{{resolve:ssm:parameter-name}}"
              ]
            }
  • What is the expected behavior (or behavior of feature suggested)? Accoring to AWS CloudFormation documentation in block SSM Parameters:

For SSM Parameters, the reference-key segment is composed of the parameter name and version number. Use the following pattern: ‘{{resolve:ssm:parameter-name:version}}’ Your reference must adhere to the following regular expression pattern for parameter-name and version: ‘{{resolve:ssm:[a-zA-Z0-9_.-/]+:\d+}}’

That means that StringListParameter should have parameter-name and version. At the moment aws cdk renders parameter-name only.

  • What is the motivation / use case for changing the behavior or adding this feature?

AWS Cloudformation shows Validation error ValidationError: Incorrect format is used in the following SSM reference: [{{resolve:ssm:parameter-name}}] Incorrect format is used in the following SSM reference: [{{resolve:ssm:parameter-name}}]

  • Please tell us about your environment:

    • CDK CLI Version: 1.3.0
    • Module Version: 1.3.0
    • OS: [Ubuntu]
    • Language: [Python]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)

ValidationError: Incorrect format is used in the following SSM reference: [{{resolve:ssm:parameter-name}}]
    at Request.extractError (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/home/user/.nvm/versions/node/v10.16.0/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
thombergscommented, Oct 4, 2020

I ran into this as well. It makes using StringListParameter in CDK impossible, currently. Any plan to fix this?

The workaround for me is to use a StringParameter with comma-separated values and to the splitting and joining myself.

2reactions
amwill04commented, Mar 5, 2020

This isn’t just a python issue, happening with typescript as well. I tried the following which does give me a valid cloudformation template but this wont work due to limitiations and buggy behaviour with how cloudformation executes rather than aws-cdk

const lambda = new Function(this, 'Lambda', {...}) // No need to set vpc here. Added benifit is actuall less code
const cfnLambda = lambda.node.defaultChild as CfnFunction;
cfnLambda.vpcConfig = {
    securityGroupIds: [vpcSecurityGroup.stringValue],
    subnetIds: Fn.split(',', new CfnDynamicReference(CfnDynamicReferenceService.SSM, `${vpcSubnetId.parameterName}:1`).toString()),
}; // where `:1` is assigning the version i wanted
Read more comments on GitHub >

github_iconTop Results From Across the Web

class StringListParameter (construct ... - AWS Documentation
class StringListParameter (construct) ... You are not viewing the latest version. ... Create a new SSM Parameter holding a String const param =...
Read more >
Using SSM Parameters in AWS CDK - Complete Guide
SSM parameter store is used to store and retrieve configuration parameters and secrets. In order to create an SSM parameter in CDK, we...
Read more >
Unable to fetch parameters from SSM using AWS CDK?
You don't need the CfnParameter construct - it requires the parameter to exist before ... StringListParameter(this, 'store-slack-ssm-param', ...
Read more >
get-parameter — AWS CLI 2.9.9 Command Reference
This flag is ignored for String and StringList parameter types. ... The generated JSON skeleton is not stable between versions of the AWS...
Read more >
@code-dome/cdk-parameter-store - npm
There are no other projects in the npm registry using ... Handle version in SSM and Secrets; Handle StringListParameter ...
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