【问题标题】:Is this not how you refer a cloudformation resource?这不是您引用 cloudformation 资源的方式吗?
【发布时间】:2021-03-05 18:38:57
【问题描述】:

使用 deisgner 构建模板,Cloudformation 给出了一个

“resourcesToImport.1.member.resourceIdentifier”中的值“{LoadBalancerArn=}”未能满足约束:映射值必须满足约束:[成员的长度必须小于或等于 2048,成员的长度必须大于或等于1];

下面的代码。对 8 个不同的资源有 8 个相同的错误。知道出了什么问题吗?

       "ELB": {
        "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
        "Properties": {...},
        "Metadata": {...}
        },
        "DeletionPolicy": "Retain"
    },
    "Listener": {
        "Type": "AWS::ElasticLoadBalancingV2::Listener",
        "Properties": {
            "DefaultActions": [
                {
                    "Type": "fixed-response",
                    "FixedResponseConfig": {
                        "ContentType": "text/plain",
                        "MessageBody": "Fixed Response",
                        "StatusCode": "200"
                    }
                }
            ],
            "LoadBalancerArn": {
                "Ref": "ELB"
            },
            "Protocol": "HTTP"
        },
        "Metadata": {
            "AWS::CloudFormation::Designer": {...}
        },
        "DependsOn": [
            "ELB"
        ],
        "DeletionPolicy": "Retain"
    }

【问题讨论】:

  • 您要导入一些资源吗?
  • @Marcin 我是。但是这两个都是要创建的。
  • 你能澄清一下你在做什么,你得到resourcesToImport 错误吗?

标签: json amazon-web-services cloud amazon-cloudformation


【解决方案1】:

至少,DeletionPolicy 处于错误的级别:

       "ELB": {
        "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
        "Properties": {...},
        "Metadata": {...}
        },
        "DeletionPolicy": "Retain"

应该在这里:

       "ELB": {
        "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
        "Properties": {...},
        "Metadata": {...}
        "DeletionPolicy": "Retain"
        },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    相关资源
    最近更新 更多