Error: reading SSM Document (-pull-models): operation error SSM: DescribeDocument, https response error StatusCode: 400, Request

Error: reading SSM Document (-pull-models): operation error SSM: DescribeDocument, https response error StatusCode: 400, RequestID: 173f4b89-1c51-46a5-b794-be87ccacce20, InvalidDocument: No matching value was found for Name.

Hi,

Sorry, not sure if this is the right place to post some difficulties I am encountering. I keep getting the above error in my code trying to create an aws_ssm_document and associate it to an ec2 instance target. The path to the document is correct but the error keeps mentioning invaliddocument :no matching value was found for Name.

The two terraform resources I am passing are:

resource “aws_ssm_document” “pull_models” {
name = “${var.llm-prefix}-pull-models”
document_type = “Command”

content = file(“${path.module}/aws-ssm-document/pull-models.json”)
}

resource “aws_ssm_association” “pull_models” {
for_each = local.ec2_configs

name = aws_ssm_document.pull_models.name
parameters = {
“Models” = join(“,”, each.value.pull_models)
}

targets {
key = “InstanceIds”
values = [aws_instance.llm[each.key].id]
}

}

the document I am trying to associate and run in the server is below. I will very much appreciate your help in resolving this.

{
“schemaVersion”: “2.2”,
“description”: “Ollama pull models.”,
“parameters”: {
“Models”: {
“type”: “String”,
“description”: “List of models to pull (comma sep).”
},
“TimeoutSeconds”: {
“type”: “String”,
“description”: “(Optional) The time in seconds for a command to be completed before it is considered to have failed.”,
“default”: “3600”
}
},
“mainSteps”: [
{
“action”: “aws:runShellScript”,
“name”: “runShellScript”,
“inputs”: {
“timeoutSeconds”: “{{ TimeoutSeconds }}”,
“runCommand”: [
“#!/bin/bash”,
“export HOME=/root”,
“while [ ! -f /var/lib/cloud/instance/boot-finished ]; do”,
" echo "Wait 10s for cloud-init to finish"“,
" sleep 10”,
“done”,
“IFS=‘,’ read -ra ms <<< "{{Models}}"”,
“for m in "${ms[@]}"; do”,
" echo "pull model $m "“,
" ollama pull $m”,
" sleep 10",
“done”
]
}
}
]
}

@dtbesong - Experiencing same issue and found this issue reported Changes to AWS API SSM DescribeDocument InvalidDocument response message is causing Terraform to fail deleting ssm documents · Issue #42125 · hashicorp/terraform-provider-aws · GitHub