I am trying to add an array of strings as an attribute to my IoT thing provisioning template.
My template looks like this:
{
"Parameters": {
"SerialNumber": {
"Type": "String"
},
"CertificateId": {
"Type": "String"
},
"UserGroup": {
"Type": "String"
},
"Roles": {
"Type": "CommaDelimitedList"
},
"ReleaseStage": {
"Type": "String"
}
},
"Resources": {
"certificate": {
"Properties": {
"CertificateId": {
"Ref": "CertificateId"
},
"Status": "Active"
},
"Type": "AWS::IoT::Certificate"
},
"thing": {
"OverrideSettings": {
"AttributePayload": "MERGE",
"ThingGroups": "DO_NOTHING",
"ThingTypeName": "REPLACE"
},
"Properties": {
"AttributePayload": {
"userGroup": { "Ref": "UserGroup" },
"roles": { "Ref": "Roles" },
"environment": { "Ref": "ReleaseStage" }
},
"ThingGroups": [],
"ThingName": {
"Ref": "SerialNumber"
}
},
"Type": "AWS::IoT::Thing"
}
}
}
I'm using the AWS Ruby SDK and the register_thing
method like this:
template_body:,
parameters: {
"SerialNumber": serial_number,
"CertificateId": certificate_id,
"UserGroup": user_group,
"Roles": roles.map(&:parameterize).join(','),
"ReleaseStage": ENV['RELEASE_STAGE'].presence || ENV['RAILS_ENV']
}
Previous to adding the Roles
property, this was working fine. Additionally, making the Roles
property a String type works.
I'm wanting the roles
attribute to result in an array in AWS, but am seeing this error now:
Aws::IoT::Errors::InvalidRequestException: Invalid registration template. Template format error: unsupported type or structure with location of [Source: (String) ...(rest of template)