Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services Fn::ImportValue未在自定义资源中工作_Amazon Web Services_Amazon Cloudformation - Fatal编程技术网

Amazon web services Fn::ImportValue未在自定义资源中工作

Amazon web services Fn::ImportValue未在自定义资源中工作,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,问题:我遇到了一个奇怪的问题,自定义资源中的cloudformation固有功能。当我使用时!导入值我的模板成功通过并部署,但如果切换到使用Fn::导入值我会收到以下错误消息: Template format error: YAML not well-formed. 为了完整性,这是有问题的资源: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Custom Ressources

问题:我遇到了一个奇怪的问题,自定义资源中的
cloudformation
固有功能。当我使用
时!导入值
我的模板成功通过并部署,但如果切换到使用
Fn::导入值
我会收到以下错误消息:

Template format error: YAML not well-formed.
为了完整性,这是有问题的资源:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Custom Ressources                                                    #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
LambdaEmptyArtifactBucket:
  DependsOn:
  - ArtifactsBucket
  Type: AWS::CloudFormation::CustomResource
  Properties: 
    ServiceToken: !ImportValue util-s3-object-remover-lambda:us-east-1:Lambda:Arn ### <<<--- WORKS
    # ServiceToken: Fn::ImportValue: util-s3-object-remover-lambda:us-east-1:Lambda:Arn ### <<<--- DOES NOT WORKS
    BucketName: !Ref ArtifactsBucket
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#定制资源#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
lambdamptyartifactbucket:
德彭森:
-人造袋鼠
类型:AWS::CloudFormation::CustomResource
特性:

ServiceToken:!ImportValue util-s3-object-remover-lambda:us-east-1:lambda:Arn###您的
Fn::ImportValue:
应该在新行或
{}
中:

  Properties: 
    ServiceToken: 
       Fn::ImportValue: util-s3-object-remover-lambda:us-east-1:Lambda:Arn
    BucketName: !Ref ArtifactsBucket

  Properties: 
    ServiceToken: {Fn::ImportValue: util-s3-object-remover-lambda:us-east-1:Lambda:Arn} 
    BucketName: !Ref ArtifactsBucket