gpt4 book ai didi

amazon-web-services - 资源输出的资源属性 MytargetGroup 无效

转载 作者:行者123 更新时间:2023-12-03 07:46:58 25 4
gpt4 key购买 nike

我正在寻找目标组的 arn 输出。正确的方法是什么?我尝试了以下方法,但没有成功。

  ### Target group ###

MyTargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
HealthCheckEnabled: true
HealthCheckIntervalSeconds: 30
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 5
Matcher:
HttpCode: "200,302"
Name: target-group-1
Protocol: HTTP
Port: 80
UnhealthyThresholdCount: 2
VpcId: !ImportValue vpc-id

#### Outputs ####

Outputs:
MyTargetGroupOutput:
Value: !GetAtt MyTargetGroup.TargetGroupArn

错误

cfn-lint

[cfn-lint] E3001: Invalid resource attribute MyTargetGroupOutput for resource Outputs

云化

An API call to CloudFormation.UpdateStackSet (RequestId: f1581762-6a59-41eb-802e-9927f849a7be) returned a ValidationError error: Invalid template resource property 'MyTargetGroupOutput' (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: bf04faf2-9dee-4874-9069-7a41a5b4d503; Proxy: null)

根据此文档,它应该像我上面那样工作,但事实并非如此。

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html

最佳答案

您有缩进问题。 Outputs 部分与 Resources 字段放置在同一级别,在本例中为 MyTargetGroup 字段等

如果您通过删除左侧的 2 个空格来更正 Outputs 部分的缩进,它将起作用。

您的代码片段应如下所示:

  ### Target group ###

MyTargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
HealthCheckEnabled: true
HealthCheckIntervalSeconds: 30
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 5
Matcher:
HttpCode: "200,302"
Name: target-group-1
Protocol: HTTP
Port: 80
UnhealthyThresholdCount: 2
VpcId: !ImportValue vpc-id

#### Outputs ####

Outputs:
MyTargetGroupOutput:
Value: !GetAtt MyTargetGroup.TargetGroupArn

关于amazon-web-services - 资源输出的资源属性 MytargetGroup 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77010107/

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