【问题标题】:Yaml validation error on TaskDefinition preventing cloudformation from reaching completionTaskDefinition 上的 Yaml 验证错误导致 cloudformation 无法完成
【发布时间】:2022-01-28 21:34:36
【问题描述】:

我正在尝试为任务定义创建 cloudformation,但我一直在任务定义的 command 部分遇到验证错误。我尝试了几种方法,但似乎都无法正确使用。

我一直在关注文档here

以下是我的两个主要尝试及其各自的错误:

Command: !Sub 
         - "--config config.yaml --env ${environment}"
         - { environment: !FindInMap [EnvironmentVariables, !Ref Environment, Environment] }
Environment] }

错误:

#/ContainerDefinitions/0/Command:预期类型:JSONArray,找到:String)

Command: !Sub 
      - [--config, config.yaml, --env, ${environment}]
      - { environment: !FindInMap [EnvironmentVariables, !Ref Environment, Environment] }

模板格式错误:YAML 格式不正确。

【问题讨论】:

    标签: amazon-web-services yaml amazon-cloudformation amazon-ecs


    【解决方案1】:

    !Sub 与 Yaml 列表的交互方式似乎存在一些问题,但我不确定是什么导致了这种情况。

    但是下面的 Yaml 设法解决了我的问题。

    Command:
            - --config 
            - config.yaml
            - --env 
            - !FindInMap [EnvironmentVariables, !Ref Environment, Environment]
    
    

    【讨论】:

      猜你喜欢
      • 2012-03-11
      • 2017-08-20
      • 2018-10-14
      • 2016-12-03
      • 2018-06-03
      • 2016-07-11
      • 1970-01-01
      • 1970-01-01
      • 2017-04-05
      相关资源
      最近更新 更多