AWS CodePipeline Github Token from SSM Failing

I’m trying to set up CodePipeline with a Github PAT from SSM ParameterStore. If I put the PAT in a variable, my code works, but if I move it to the ParameterStore it fails.

The not working code:

  stage {
    name = "Pull"

    action {
      name = "Pull"
      category = "Source"
      owner = "ThirdParty"
      provider = "GitHub"
      version = "1"
      output_artifacts = ["infra"]

      configuration = {
        Owner = "org"
        Repo = "repo"
        Branch = var.branch
        OAuthToken = "${data.aws_ssm_parameter.github_token.value}"
      }
    }

The working code:

stage {
    name = "Pull"

    action {
      name = "Pull"
      category = "Source"
      owner = "ThirdParty"
      provider = "GitHub"
      version = "1"
      output_artifacts = ["infra"]

      configuration = {
        Owner = "org"
        Repo = "repo"
        Branch = var.branch
        OAuthToken = var.token
      }
    }

I’ve tried basically everything I can think of. I’ve unquoted the SSM result. I’ve moved the SSM result to a aws_codebuild_source_credential. I’m not totally sure what I’m missing. Please advise.