importValue函数在cloudformation中不起作用

时间:2017-09-19 16:34:00

标签: amazon-web-services elastic-beanstalk amazon-cloudformation

我在cloudformation中看到了云形成导入值函数的一个非常奇怪的问题。我正在尝试创建一个cloudformation beanstalk环境。在configurationTemplate部分我有:

 configurationTemplateChannel:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
  ApplicationName:
  - Fn::ImportValue:
      Fn::Sub: "${StackNamePrefix}-BeanstalkId-test"
  Description: AWS ElasticBeanstalk Sample Configuration Template
  OptionSettings:
       .
       .
       .         
  - Namespace: aws:ec2:vpc
    OptionName: VPCId
    Value:
      Fn::ImportValue:
        Fn::Sub: "${StackNamePrefix}-vpc-VpcId"
     .
     .
     .

如您所见,我在ApplicationName中导入了导致:

An error occurred (ValidationError) when calling the CreateStack operation: [/Re                    sources/configurationTemplateChannel/Type/OptionSettings/6/Value/0/Fn::ImportVal                    ue] 'null' values are not allowed in templates

我做错了吗?这是否意味着我不能在这里使用导入选项?

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

对于更多读者:当我用Fn :: ImportValue替换它时,我发现了问题:!Sub $ {StackNamePrefix} -BeanstalkId-test it works