(aws-s3-assets): generated CloudFormation template seems to be missing values
See original GitHub issueHello there,
not sure whether this is a real bug, or I am misusing the API. I hope for the latter. When using S3 assets and accessing them the output template is missing values. Therefore the stack cannot be deployed. In my example I try to pass the information of this Asset
const ebArchive = new s3assets.Asset(this, "EbAppArchive", {
path: `${__dirname}/../build`,
});
to Eb by using CfnApplicationVersion
.
const appVersionProps = new eb.CfnApplicationVersion(this, "AppVersion", {
applicationName,
sourceBundle: {
s3Bucket: ebArchive.s3BucketName,
s3Key: ebArchive.s3ObjectKey,
},
});
which leads to the following error message in CodePipeline:
An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3VersionKeyAE6E494D, AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D, AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eArtifactHash0AEAA959] must have values
It has produced the template that you can see below.
Reproduction Steps
I have been using basically this stack: https://github.com/kts102121/cdk-elasticbeanstalk-examples/blob/master/lib/elasticbeanstalk-stack.ts
However, I am using cdk 1.80 while the repo above is using 1.61. The issue is reproduceable on both versions.
I am taking the following steps:
npm run build
npm run cdk synth EbStack -- -o dist
aws cloudformation deploy --template-file ./dist/EbStack.template.json --stack-name EbStack
Note: This is only to mimic what codepipeline would probably do.
And most notably: Deploying with cdk deploy
WILL work and deploy the stack as intended.
What did you expect to happen?
I expect CodePipeline to be able to deploy my stack that has been created with the CDK.
What actually happened?
CodePipeline failed with the following error:
An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3VersionKeyAE6E494D, AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D, AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eArtifactHash0AEAA959] must have values
while cdk deploy
is deploying just fine.
Environment
- CDK CLI Version : 1.80.0
- Framework Version: 1.80.0
- Node.js Version: 14.12.0
- OS : Whatever runs on CodePipeline and Windows 10 1909 (Build 18363.1256)
- Language (Version): Typescript 4.1.3
Other
EbStack.template.json (output)
{
"Resources": {
"MyUserGroupDA7A39B2": {
"Type": "AWS::IAM::Group",
"Metadata": {
"aws:cdk:path": "EbStack/MyUserGroup/Resource"
}
},
"MyUserGroupDefaultPolicy50C5D742": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:GetObject*",
"s3:GetBucket*",
"s3:List*"
],
"Effect": "Allow",
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D"
}
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D"
},
"/*"
]
]
}
]
}
],
"Version": "2012-10-17"
},
"PolicyName": "MyUserGroupDefaultPolicy50C5D742",
"Groups": [
{
"Ref": "MyUserGroupDA7A39B2"
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/MyUserGroup/DefaultPolicy/Resource"
}
},
"EbRoleF0D9485E": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AWSElasticBeanstalkWebTier"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AWSElasticBeanstalkWorkerTier"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AmazonSSMManagedInstanceCore"
]
]
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/EbRole/Resource"
}
},
"EbRoleDefaultPolicy18B2327D": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:GetObject*",
"s3:GetBucket*",
"s3:List*"
],
"Effect": "Allow",
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D"
}
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D"
},
"/*"
]
]
}
]
}
],
"Version": "2012-10-17"
},
"PolicyName": "EbRoleDefaultPolicy18B2327D",
"Roles": [
{
"Ref": "EbRoleF0D9485E"
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/EbRole/DefaultPolicy/Resource"
}
},
"EbInstanceProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Roles": [
{
"Ref": "EbRoleF0D9485E"
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/EbInstanceProfile"
}
},
"EbSecretsManagerPolicyE9AD5731": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "secretsmanager:GetSecretValue",
"Effect": "Allow",
"Resource": {
"Fn::ImportValue": "RdsStack:ExportsOutputRefRdsCredentials9FB39D528C70F7D9"
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "eb-secrets-manager-policy",
"Roles": [
{
"Ref": "EbRoleF0D9485E"
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/EbSecretsManagerPolicy/Resource"
}
},
"EbTaggingPolicy84B77178": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"tag:GetResources",
"tag:TagResources",
"tag:UntagResources",
"tag:GetTagKeys",
"tag:GetTagValues",
"cloudfront:GetDistribution",
"acm:ListCertificates"
],
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "eb-tagging-policy",
"Roles": [
{
"Ref": "EbRoleF0D9485E"
}
]
},
"Metadata": {
"aws:cdk:path": "EbStack/EbTaggingPolicy/Resource"
}
},
"Application": {
"Type": "AWS::ElasticBeanstalk::Application",
"Properties": {
"ApplicationName": "Application"
},
"Metadata": {
"aws:cdk:path": "EbStack/Application"
}
},
"AppVersion": {
"Type": "AWS::ElasticBeanstalk::ApplicationVersion",
"Properties": {
"ApplicationName": "Application",
"SourceBundle": {
"S3Bucket": {
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D"
},
"S3Key": {
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3VersionKeyAE6E494D"
}
]
}
]
},
{
"Fn::Select": [
1,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3VersionKeyAE6E494D"
}
]
}
]
}
]
]
}
}
},
"DependsOn": [
"Application"
],
"Metadata": {
"aws:cdk:path": "EbStack/AppVersion"
}
},
"EbEnvironment": {
"Type": "AWS::ElasticBeanstalk::Environment",
"Properties": {
"ApplicationName": "Application",
"EnvironmentName": "eb-environment",
"OptionSettings": [
{
"Namespace": "aws:autoscaling:asg",
"OptionName": "MinSize",
"Value": "1"
},
{
"Namespace": "aws:autoscaling:asg",
"OptionName": "MaxSize",
"Value": "1"
},
{
"Namespace": "aws:ec2:vpc",
"OptionName": "VPCId",
"Value": {
"Fn::ImportValue": "VpcStack:ExportsOutputRefAppVpc80F1F7F93D0AA00C"
}
},
{
"Namespace": "aws:ec2:vpc",
"OptionName": "Subnets",
"Value": {
"Fn::Join": [
"",
[
{
"Fn::ImportValue": "VpcStack:ExportsOutputRefAppVpcAppSubnet1Subnet9DDA5475B191A1B1"
},
",",
{
"Fn::ImportValue": "VpcStack:ExportsOutputRefAppVpcAppSubnet2SubnetA3D6946AD1607F9D"
}
]
]
}
},
{
"Namespace": "aws:ec2:vpc",
"OptionName": "ELBSubnets",
"Value": {
"Fn::Join": [
"",
[
{
"Fn::ImportValue": "VpcStack:ExportsOutputRefAppVpcPublicSubnet1SubnetDD9E0A0845FFF58F"
},
",",
{
"Fn::ImportValue": "VpcStack:ExportsOutputRefAppVpcPublicSubnet2SubnetDFE2ABB8EA76A10F"
}
]
]
}
},
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "IamInstanceProfile",
"Value": {
"Fn::GetAtt": [
"EbInstanceProfile",
"Arn"
]
}
},
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "InstanceType",
"Value": "t2.micro"
},
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "SecurityGroups",
"Value": {
"Fn::ImportValue": "VpcStack:ExportsOutputFnGetAttASGSecurityGroup3960D0B6GroupIdB190CD21"
}
},
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "SSHSourceRestriction",
"Value": {
"Fn::Join": [
"",
[
"tcp, 22, 22, ",
{
"Fn::ImportValue": "VpcStack:ExportsOutputFnGetAttASGSecurityGroup3960D0B6GroupIdB190CD21"
}
]
]
}
},
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "EC2KeyName",
"Value": "ApplicationKeys"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "EnableSpot",
"Value": "true"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "InstanceTypes",
"Value": "t2.micro,c3.large,c4.large,c5.large,m4.large,m5.large"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "SpotFleetOnDemandBase",
"Value": "1"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "SpotFleetOnDemandAboveBasePercentage",
"Value": "30"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "SpotMaxPrice",
"Value": "null"
},
{
"Namespace": "aws:elasticbeanstalk:environment",
"OptionName": "LoadBalancerType",
"Value": "application"
},
{
"Namespace": "aws:autoscaling:trigger",
"OptionName": "LowerThreshold",
"Value": "5"
},
{
"Namespace": "aws:autoscaling:trigger",
"OptionName": "MeasureName",
"Value": "CPUUtilization"
},
{
"Namespace": "aws:autoscaling:trigger",
"OptionName": "Unit",
"Value": "Percent"
},
{
"Namespace": "aws:autoscaling:trigger",
"OptionName": "UpperBreachScaleIncrement",
"Value": "2"
},
{
"Namespace": "aws:autoscaling:trigger",
"OptionName": "UpperThreshold",
"Value": "20"
},
{
"Namespace": "aws:elasticbeanstalk:cloudwatch:logs",
"OptionName": "StreamLogs",
"Value": "true"
},
{
"Namespace": "aws:elasticbeanstalk:cloudwatch:logs",
"OptionName": "DeleteOnTerminate",
"Value": "true"
},
{
"Namespace": "aws:elasticbeanstalk:cloudwatch:logs",
"OptionName": "RetentionInDays",
"Value": "1"
},
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "SECRET_ARN",
"Value": {
"Fn::ImportValue": "RdsStack:ExportsOutputRefRdsCredentials9FB39D528C70F7D9"
}
},
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "SPRING_PROFILES_ACTIVE",
"Value": "prod"
},
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "DB_URL",
"Value": {
"Fn::ImportValue": "RdsStack:ExportsOutputFnGetAttPostgresDb29EB1611EndpointAddressC3ED2541"
}
}
],
"SolutionStackName": "64bit Amazon Linux 2 v5.2.3 running Node.js 12",
"VersionLabel": {
"Ref": "AppVersion"
}
},
"DependsOn": [
"Application"
],
"Metadata": {
"aws:cdk:path": "EbStack/EbEnvironment"
}
},
"CDKMetadata": {
"Type": "AWS::CDK::Metadata",
"Properties": {
"Modules": "aws-cdk=1.80.0,@aws-cdk/assets=1.80.0,@aws-cdk/aws-applicationautoscaling=1.80.0,@aws-cdk/aws-autoscaling=1.80.0,@aws-cdk/aws-autoscaling-common=1.80.0,@aws-cdk/aws-autoscaling-hooktargets=1.80.0,@aws-cdk/aws-certificatemanager=1.80.0,@aws-cdk/aws-cloudformation=1.80.0,@aws-cdk/aws-cloudfront=1.80.0,@aws-cdk/aws-cloudwatch=1.80.0,@aws-cdk/aws-codebuild=1.80.0,@aws-cdk/aws-codeguruprofiler=1.80.0,@aws-cdk/aws-codepipeline=1.80.0,@aws-cdk/aws-codepipeline-actions=1.80.0,@aws-cdk/aws-ec2=1.80.0,@aws-cdk/aws-ecr=1.80.0,@aws-cdk/aws-ecr-assets=1.80.0,@aws-cdk/aws-ecs=1.80.0,@aws-cdk/aws-elasticbeanstalk=1.80.0,@aws-cdk/aws-elasticloadbalancingv2=1.80.0,@aws-cdk/aws-events=1.80.0,@aws-cdk/aws-events-targets=1.80.0,@aws-cdk/aws-iam=1.80.0,@aws-cdk/aws-kms=1.80.0,@aws-cdk/aws-lambda=1.80.0,@aws-cdk/aws-logs=1.80.0,@aws-cdk/aws-rds=1.80.0,@aws-cdk/aws-route53=1.80.0,@aws-cdk/aws-route53-targets=1.80.0,@aws-cdk/aws-s3=1.80.0,@aws-cdk/aws-s3-assets=1.80.0,@aws-cdk/aws-sam=1.80.0,@aws-cdk/aws-secretsmanager=1.80.0,@aws-cdk/aws-servicediscovery=1.80.0,@aws-cdk/aws-sns=1.80.0,@aws-cdk/aws-sns-subscriptions=1.80.0,@aws-cdk/aws-sqs=1.80.0,@aws-cdk/aws-ssm=1.80.0,@aws-cdk/cloud-assembly-schema=1.80.0,@aws-cdk/core=1.80.0,@aws-cdk/custom-resources=1.80.0,@aws-cdk/cx-api=1.80.0,@aws-cdk/region-info=1.80.0,jsii-runtime=node.js/v14.12.0"
},
"Metadata": {
"aws:cdk:path": "EbStack/CDKMetadata/Default"
}
}
},
"Parameters": {
"AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3Bucket49604C2D": {
"Type": "String",
"Description": "S3 bucket for asset \"72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0e\""
},
"AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eS3VersionKeyAE6E494D": {
"Type": "String",
"Description": "S3 key for asset version \"72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0e\""
},
"AssetParameters72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0eArtifactHash0AEAA959": {
"Type": "String",
"Description": "Artifact hash for asset \"72747427f13e22d8884272e2aebf1982297a5be52d48e85e0dfe0fa8c6ab8f0e\""
}
},
"Outputs": {
"ExportsOutputFnGetAttEbEnvironmentEndpointURL24F64FB9": {
"Value": {
"Fn::GetAtt": [
"EbEnvironment",
"EndpointURL"
]
},
"Export": {
"Name": "EbStack:ExportsOutputFnGetAttEbEnvironmentEndpointURL24F64FB9"
}
}
}
}
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Did I read the big yellow box at the bottom of the page? I certainly did not.
Thank you for your fantastic help @skinny85
⚠️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.