【问题标题】:importValue function does not work in cloudformationimportValue 功能在 cloudformation 中不起作用
【发布时间】:2018-02-28 13:01:31
【问题描述】:

我看到 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

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

任何帮助将不胜感激

【问题讨论】:

  • 错误sources/configurationTemplateChannel/Type/OptionSettings/6/Value/0/... 中的路径似乎没有反映您问题中的模板。你能确定是吗?您是否还可以使用更多上下文更新您的代码 sn-p,因为错误可能隐藏在那里。
  • 嘿thanx 回答,这是我在终端中使用我认为正确的文件运行的内容。现在我用 Fn::ImportValue: !Sub ${StackNamePrefix}-BeanstalkId-test 替换它时发现了问题,但问题是有什么区别?为什么它适用于第二个?
  • 我真的无法解释,因为它们几乎是一回事。不过,我更喜欢简写的 ! 版本,所以改用这种语法并不是一件坏事。
  • 是的,感谢您的反馈

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2018-04-04
    • 1970-01-01
    • 2021-04-19
    • 1970-01-01
    • 1970-01-01
    • 2021-08-10
    • 2020-08-06
    • 1970-01-01
    • 2019-07-09
    相关资源
    最近更新 更多