importValue 函数在 cloudformation 中不起作用

importValue function does not work in cloudformation

我在 cloudformation 中看到一个关于 cloud formation import value function 的非常奇怪的问题。我正在尝试创建一个 cloudformation beanstalk 环境。在配置模板部分我有:

 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

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

如有任何帮助,我们将不胜感激

致更多读者:当我将其替换为 Fn::ImportValue 时发现了问题:!Sub ${StackNamePrefix}-BeanstalkId-test it works