Template error: instance of Fn::GetAtt references undefined resource
Asked Answered
L

1

6

I have this cloudformation template :

"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" },
  }
},

When I validate the template I get this error :

An error occurred (ValidationError) when calling the ValidateTemplate operation: Template error: instance of Fn::GetAtt references undefined resource InstanceProfileProd

The resources are all properly defined and well writen; I don't understand why I am getting this error. The instance profile is referenced in all the layers of my opsworks stack.

Lavona answered 25/1, 2017 at 15:37 Comment(1)
Beyond the JSON syntax error, if your issue still occurs please post a complete stack template that reproduces the issue, not just a small section of a larger template. To quote the FAQ, "The problem might not be in the part you suspect it is, but another part entirely."Prostate
P
2

Your JSON is not well-formed.

  • The line below CustomJSON has an extra closing bracket that should be removed:

    },
    
  • There is a typo in profils that doesn't seem intentional (though probably unrelated to the current error).

Prostate answered 25/1, 2017 at 16:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.