Aws-cdk: core.CfnOutput strips "-" from id

Created on 30 Oct 2019  Â·  3Comments  Â·  Source: aws/aws-cdk

core.CfnOutput(
                    self,
                    "{aa}-export".format(aa="ManagedInstanceProfile"),
                    value=ManagedInstanceProfile.attr_arn,
                    export_name="ManagedInstanceProfile",
                )

produces

cdk-infra.ManagedInstanceProfileexport

Reproduction Steps

try:

core.CfnOutput(
                    self,
                    "{aa}-export".format(aa="<somename>"),
                    value=<somevalue>,
                    export_name="<somename>",
                )

or

core.CfnOutput(
                    self,
                    "{aa}-Export".format(aa="<somename>"),
                    value=<somevalue>,
                    export_name="<somename>",
                )

Error Log

Environment

  • **CLI Version :1.15.0 (build bdbe3aa)
  • **OS :WSL Ubuntu 18.04
  • **Language :Python 3.6.8

This is :bug: Bug Report

@aws-cdcore bug efforsmall p1

All 3 comments

Another example:

cdk diff gami-cdk-infra
Stack gami-cdk-infra
Outputs
[-] Output ManagedInstanceProfileexport: {"Value":{"Fn::GetAtt":["ManagedInstanceProfile","Arn"]},"Export":{"Name":"ManagedInstanceProfile"}}
[+] Output ManagedInstanceProfile-Export ManagedInstanceProfileExport: {"Value":{"Fn::GetAtt":["ManagedInstanceProfile","Arn"]},"Export":{"Name":"ManagedInstanceProfile"}}

(.env) machine::✔ ~/git/gami/cdk $ [cdk {origin/cdk}|✚ 1] 
08:42 $ cdk deploy gami-cdk-infra
gami-cdk-infra: deploying...
gami-cdk-infra: creating CloudFormation changeset...
 0/1 | 8:42:36 AM | UPDATE_IN_PROGRESS   | AWS::CloudFormation::Stack | gami-cdk-infra User Initiated

 ✅  gami-cdk-infra

Outputs:
gami-cdk-infra.ManagedInstanceProfileExport = arn:aws:iam::<>:instance-profile/gami-cdk-infra-ManagedInstanceProfile-<>

As per https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html, the logical id must be alphanumeric (a-z, A-Z, 0-9).

@eladb Not sure what the changes are required. Maybe the validation for input (e.g. id).

@sayboras oh that makes 💯 sense.

âž• on a validation then

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rix0rrr picture rix0rrr  Â·  61Comments

laimonassutkus picture laimonassutkus  Â·  34Comments

PygmalionPolymorph picture PygmalionPolymorph  Â·  53Comments

alexdilley picture alexdilley  Â·  71Comments

thibaut-singlefile picture thibaut-singlefile  Â·  27Comments