Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Template error: instance of Fn::GetAtt references undefined resource

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.

like image 458
JavaQueen Avatar asked Oct 30 '22 13:10

JavaQueen


1 Answers

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).

like image 69
wjordan Avatar answered Nov 15 '22 09:11

wjordan