-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.
Description
🐛 Bug Report
What is the problem?
Specifying core.Aws.STACK_NAME as a value to the Stack wide Tags causes cdk deploy to report an error. The same configuration is not reported as erroneous when using cdk synth. Tags are supported on all the resources in use (S3, DynamoDB table, and Kinesis stream).
Reproduction Steps
Using this file
from aws_cdk.core import App, Aws, Stack, Tag
from aws_cdk import aws_s3 as s3
class ServiceStack(Stack):
def __init__(self, app: App, id: str, **kwargs) -> None:
super().__init__(app, id, **kwargs)
# Define S3 service
r3 = s3.Bucket(self, 'Bucket')
# Add tags to all resources in the stack
Tag.add(self, 'Instance', Aws.STACK_NAME)
app = App()
ServiceStack(app, "s1")
app.synth()
And then running this command
cdk deploy
Verbose Log
s1: deploying...
s1: creating CloudFormation changeset...
❌ s1 failed: InvalidParameterType: Expected params.Tags[0].Value to be a string
at ParamValidator.fail (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:50:37)
at ParamValidator.validateType (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:232:10)
at ParamValidator.validateString (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:154:32)
at ParamValidator.validateScalar (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:130:21)
at ParamValidator.validateMember (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:94:21)
at ParamValidator.validateStructure (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:75:14)
at ParamValidator.validateMember (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:88:21)
at ParamValidator.validateList (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:103:14)
at ParamValidator.validateMember (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:90:21)
at ParamValidator.validateStructure (/usr/local/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/param_validator.js:75:14) {
message: 'Expected params.Tags[0].Value to be a string',
code: 'InvalidParameterType',
time: 2019-09-16T21:40:53.822Z
}
Expected params.Tags[0].Value to be a string
Environment
- CDK CLI Version: 1.8.0 (build 5244f97)
- Module Version:
- OS: OSX
- Language: Python
Other information
Generated synth output is
Resources:
Bucket83908E77:
Type: AWS::S3::Bucket
Properties:
Tags:
- Key: Instance
Value:
Ref: AWS::StackName
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: s1/Bucket/Resource
Which boots fine in CloudFormation if you manually upload the template
Metadata
Metadata
Assignees
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.