0

Getting this error when creating SSM document: invalidDocumentContent: YAML not well-formed.

This is the line below that the error references "$version = '6.18'",

I get the same error on other lines in the new block, so if I can figure out this line, I can figure out the rest too.

I cloned a working SSM document and put this block of code in. The document works fine besides this block. I'm just perplexed, and I am sure this is due to my inexperience and the answer is simple and I will feel stupid when it's revealed...

Document:

    {
  "schemaVersion": "2.2",
  "description": "X",
  "parameters": {},
  "mainSteps": [
    {
      "action": "aws:runPowerShellScript",
      "name": "dbaCustomizations",
      "precondition": {
        "StringEquals": [
          "platformType",
          "Windows"
        ]
      },
      "inputs": {
        "runCommand": [
          "$errorActionPreference = 'stop'",
          "try {",
          "$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'",
          "[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "",
          "# PG admin separately for the ALLUSERS flag for now. ",
          "$version = '6.18'",
          "$output = [string]::Format('C:\pgadmin4-{0}-x64.exe',$version)",
          "$url = [string]::Format('https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v{0}/windows/pgadmin4-{0}-x64.exe',$version)",
          "(New-Object Net.WebClient).DownloadFile($url, $output)",
          "Start-Process -Wait -FilePath $output -ArgumentList '/ALLUSERS /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -PassThru",
          "}",
          "} catch",
          "{",
          "    Write-Output \"Error encountered \" + $Error[0].Exception.Message",
          "    exit 1",
          "}",
          ""
        ],
        "timeoutSeconds": 7200
      }
    }
  ]
}
  • Hi @theJamester. Welcome to StackOverflow!!! Can you attach the full document here after redacting the sensitive data. Since yaml is intendation based, errors are hard to figure out without seeing the full document. – user11666461 Jan 10 '23 at 00:46
  • this line is not within any brackets or part of any if statements.... the entire block in question is left-aligned with the rest of the document. It's just part of a block to install pgadmin. Here is the entire block.... – theJamester Jan 10 '23 at 07:04
  • "$version = '6.18'", "$output = [string]::Format('C:\pgadmin4-{0}-x64.exe',$version)", "$url = [string]::Format('https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v{0}/windows/pgadmin4-{0}-x64.exe',$version)", "(New-Object Net.WebClient).DownloadFile($url, $output)", "Start-Process -Wait -FilePath $output -ArgumentList '/ALLUSERS /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -PassThru", – theJamester Jan 10 '23 at 07:07
  • (your auto-formatting causes the lines to merge. I haven't figured out how to fix that to make it easier for you to read....) – theJamester Jan 10 '23 at 07:10
  • Please update the question with your template. Format the template as code for it to avoid getting auto-formatted – user11666461 Jan 10 '23 at 11:45
  • Done. Hope I did it right. – theJamester Jan 10 '23 at 19:53

0 Answers0