0

I am attempting to create a Cloudformation template to configure an IAM role.

As far as I can tell my JSON is 100% valid but apparently I'm overlooking something else because it's not able to be validated:

A client error (ValidationError) occurred when calling the ValidateTemplate operation: Invalid template resource property 'BambooInstanceProfile'

My code:

{
  "Description" : "Bamboo IAM role",

  "Parameters" : {

  },



  "Resources" : {  


    "BambooAgentRole" : {
         "Type": "AWS::IAM::Role",
         "Properties": {
            "AssumeRolePolicyDocument": {
               "Version" : "2012-10-17",
               "Statement": [ {
                  "Effect": "Allow",
                  "Principal": {
                     "Service": [ "ec2.amazonaws.com" ]
                  },
                  "Action": [ "sts:AssumeRole" ]
               }  ]

            },
            "Path": "/devtools/bamboo/",
            "Policies": [ {
               "PolicyName": "ec2_bamboo",
               "PolicyDocument": {
                  "Version" : "2012-10-17",
                  "Statement": [ {
                    "Effect": "Allow",
                    "Action": [
                      "ec2:DescribeTags",
                      "ec2:DescribeInstances"
                      ],
                      "Resource": "*"
                  } ]
              }
              } ]
      },
      "BambooInstanceProfile": {
        "Type": "AWS::IAM::InstanceProfile",
        "Properties": {
           "Path": "/devtools/bamboo/",
           "Roles": [ {
              "Ref": "BambooAgentRole"
           } ]
        }  
      }
    }  
  },







  "Outputs" : {
    "IAM" : { "Value" : { "Ref" : "BambooInstanceProfile" }}
  }


}

What am I overlooking here?

1

You have set "BambooInstanceProfile" as an attribute of "BambooAgentRole" instead of it's own resource. One more } needs to come before your "BambooInstanceProfile".

  • Yep, it's probably linting as valid JSON because there are too many closing curly brackets at the end of the Instance Profile Resource. Looks like your opening and closing brackets got out of line. – Canuteson Sep 10 '16 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.