gpt4 book ai didi

yaml - AWS CloudFormation 属性验证失败 : [Encountered unsupported properties in {/ContainerProperties/Environment

转载 作者:行者123 更新时间:2023-12-03 07:23:49 26 4
gpt4 key购买 nike

我正在使用 AWS Batch 创建 POC。为了创建基础设施,我使用 AWS CloudFormation。

我的资源AWS::Batch::JobDefinition有问题

  ContentInputJob:
Type: "AWS::Batch::JobDefinition"
Properties:
Type: Container
ContainerProperties:
Environment:
- name: SECRETS
value: '**********'
Command:
- -v
- process
- new-file
- -o
Image: !Join ['', [!Ref 'AWS::AccountId','.dkr.ecr.', !Ref 'AWS::Region', '.amazonaws.com/', !Ref ImageName ] ]
JobRoleArn: !Ref BatchContainerIAMRole
Memory: 128
Vcpus: 2
JobDefinitionName: DemoContentInput
RetryStrategy:
Attempts: 1

创建堆栈失败,并显示...“属性验证失败:[在 {/ContainerProperties/Environment/0} 中遇到不支持的属性:[名称、值]]”

我读到:

我也尝试过:

  ContentInputJob:
Type: "AWS::Batch::JobDefinition"
Properties:
Type: Container
ContainerProperties:
Environment:
- SECRETS: '**********'
Command:
- -v
- process
- new-file
- -o
Image: !Join ['', [!Ref 'AWS::AccountId','.dkr.ecr.', !Ref 'AWS::Region', '.amazonaws.com/', !Ref ImageName ] ]
JobRoleArn: !Ref BatchContainerIAMRole
Memory: 128
Vcpus: 2
JobDefinitionName: DemoContentInput
RetryStrategy:
Attempts: 1

然后我收到“属性验证失败:[在 {/ContainerProperties/Environment/0} 中遇到不支持的属性:[SECRETS]]”

这个的语法是怎样的?我需要多个环境变量。

      ContainerProperties: 
Environment:
- name: SECRETS
value: '**********'
- name: SECRETS2
value: '**********'

最佳答案

建议尝试CloudFormation LinterVSCode在创作模板以及自动完成和文档链接时查看其中一些内联错误:

Visual Studio Code extension

[cfn-lint] E3002: Invalid Property Resources/ContentInputJob/Properties/ContainerProperties/Environment/0/name
[cfn-lint] E3002: Invalid Property Resources/ContentInputJob/Properties/ContainerProperties/Environment/0/value

关于yaml - AWS CloudFormation 属性验证失败 : [Encountered unsupported properties in {/ContainerProperties/Environment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65663604/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com