【发布时间】:2021-04-19 02:47:18
【问题描述】:
问题:
我有一个 cloudformation 模板,它应该检索在CodeCommit 中找到的代码并将其推送到Lambda。 CodeCommit 中的代码还包含一个带有一些参数的SAM 模板。 SAM 模板具有以下设置
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: SAM Template for Deploy Python code to Lambda
Parameters:
ArtifactsBucket:
Description: The artifact bucket to get the lambda code
Type: String
Name:
Description: Name of the lambda function
Type: String
SqsARN:
Description: AWS SQS Arn to act as a trigger for the lambda function
Type: String
...
并且CodePipeline Cloudformation 模板具有以下内容来覆盖SAM 模板中存在的3 个参数。
...
- Name: Deploy
Actions:
- Name: Deploy
ActionTypeId:
Category: Deploy
Owner: AWS
Provider: CloudFormation
Version: 1
Configuration:
ActionMode: CREATE_UPDATE
Capabilities: 'CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND,CAPABILITY_NAMED_IAM'
ChangeSetName: !Join
- '-'
- - lambda
- !Ref CodeCommitRepoName
ParameterOverrides: !Sub |
{
"ArtifactsBucket": "${ArtifactsBucket}",
"Name": "${CodeCommitRepoName}",
"SqsARN": {"Fn::ImportValue": "My-queue:us-east-1:Queue:Arn"}
}
...
ArtifactBucket 和 Name 参数很容易被 !Sub 函数更改,但我无法为 SqsARN 提供有效值,这是一个导入的值。
问题有没有在ParametersOverride 中包含ImportValue 和Sub 函数?
尝试我也尝试过切换
{"Fn::ImportValue": "My-queue:us-east-1:Queue:Arn"}
到
!ImportValue": "My-queue:us-east-1:Queue:Arn"
这也不起作用。删除!Sub 函数并使用!Ref 函数会产生与ImportValue 相同的输出/问题。
【问题讨论】:
-
您能否澄清
My-queue:us-east-1:Queue:Arn是您在CFN 中导出的实际名称?
标签: amazon-web-services amazon-cloudformation aws-codepipeline