【发布时间】:2017-06-10 20:52:27
【问题描述】:
我有这个 cloudformation 模板:
"InstanceProfileProd": {
"Type" : "AWS::IAM::InstanceProfile",
"Properties": {
"Path": "/",
"Roles" : [ { "Ref" : "InstanceRole"} ]
}
},
"CompLayer": {
"Type": "AWS::OpsWorks::Layer",
"DependsOn" : "OpsWorksServiceRole",
"Properties": {
"AutoAssignElasticIps" : false,
"AutoAssignPublicIps" : true,
"CustomJson" : {
},
"awscli" : {
"profils" : {
"default" : {
"role_arn": { "Fn::GetAtt": [ "InstanceProfileProd","Arn" ] }
}
}
},
},
"CustomSecurityGroupIds" : { "Ref" : "SecurityGroupIds" },
"EnableAutoHealing" : true,
"InstallUpdatesOnBoot": false,
"LifecycleEventConfiguration": {
"ShutdownEventConfiguration": {
"DelayUntilElbConnectionsDrained": false,
"ExecutionTimeout": 120 }
},
"Name": "Layer",
"Shortname" : "layer1",
"StackId": { "Ref": "CompStack" },
}
},
当我验证模板时出现此错误:
An error occurred (ValidationError) when calling the ValidateTemplate operation: Template error: instance of Fn::GetAtt references undefined resource InstanceProfileProd
资源都被正确定义和写得很好;我不明白为什么我会收到这个错误。 我的 opsworks 堆栈的所有层都引用了实例配置文件。
【问题讨论】:
-
除了 JSON 语法错误之外,如果您的问题仍然存在,请发布一个完整的堆栈模板来重现该问题,而不仅仅是较大模板的一小部分。引用FAQ,“问题可能不在您怀疑的部分,而是完全在另一部分。”
标签: json amazon-cloudformation aws-opsworks