【问题标题】:Error: At least one Resources member must be defined. when uploading template file CloudFormation to allow exterrnal DNS on EKS cluster错误:必须定义至少一个资源成员。上传模板文件 CloudFormation 以允许 EKS 集群上的外部 DNS 时
【发布时间】:2022-01-11 05:07:51
【问题描述】:

我收到“模板格式错误:必须定义至少一个资源成员”。当我尝试将模板文件上传到 cloudFormation 以允许我的 EKS 集群上的外部 DNS 时出错 我要上传的文件是

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:ChangeResourceRecordSets"
            ],
            "Resource": [
                "arn:aws:route53:::hostedzone/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "route53:ListHostedZones",
                "route53:ListResourceRecordSets"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Obviously I'm pretty new to this..can anybody give me a clue to where I am going wrong?

【问题讨论】:

  • 进展如何?仍然不清楚你能做什么?

标签: amazon-cloudformation amazon-eks


【解决方案1】:

您的 CloudFormation 没有必需的 Resources 部分。请检查正确的format of a template

【讨论】:

  • 感谢 Marcin ......你是对的......最终它需要看起来像这样。开头 `"Resources": { "ExternalDnsIamPolicy": { "Type": "AWS::IAM::ManagedPolicy", "Properties": { "PolicyDocument" : { "Version": "2012-10-17", “声明”:[{“效果”:“允许”,“动作”:[“route53:ChangeResourceRecordSets”
【解决方案2】:

修复它的完整代码是

"AWSTemplateFormatVersion": "2010-09-09",
    "Description": "The IAM Resources for External DNS",
    "Parameters": {
        "DeployRole": {
            "Description": "Decide whether deploy or not the IAM Role",
            "Type": "String",
            "Default": "no",
            "AllowedValues": [
                "yes",
                "no"
            ]
        }
    },
    "Conditions": {
        "CreateIamRole": { "Fn::Equals": [ { "Ref": "DeployRole" }, "yes"] }
    },
    "Resources": {
        
        "ExternalDnsIamPolicy": {
            "Type": "AWS::IAM::ManagedPolicy",
            "Properties": {
                "PolicyDocument" : {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Action": [
                                "route53:ChangeResourceRecordSets"
                            ],
                            "Resource": [
                                "arn:aws:route53:::hostedzone/*"
                            ]
                        },
                        {
                            "Effect": "Allow",
                            "Action": [
                                "route53:ListHostedZones",
                                "route53:ListResourceRecordSets"
                            ],
                            "Resource": [
                                "*"
                            ]
                        }
                    ]
                },
                "ManagedPolicyName" : "ExternalDNSPolicy"
            }
        }
        
    }
}

【讨论】:

    猜你喜欢
    • 2019-03-11
    • 2017-05-30
    • 1970-01-01
    • 2020-07-09
    • 2016-03-21
    • 2018-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多