How to create a cloudwatch event bridge target to fill in the constant parameters with tf

Hello, I am unable to find terraform to support filling out the details in the photo to configure parameters for the “Configure target input” type of “Constant.”

My terraform code currently looks something like the below, but this code will not fill in those same sections. From the event bridge target tab everything seems to be correct, but when I click to edit to check if it was filled out, it’s all blank and won’t work and I’m not receiving any errors. I’ve tried many things, but this is the baseline I’ve come back to. Any help would be greatly appreciated!

resource "aws_cloudwatch_event_target" "test" {
  target_id = "test"
  rule      = aws_cloudwatch_event_rule.console.name
  arn       = “arn:<region>:ssm:::document/AWS-RunRemoteScript” 
  Role_arn = aws_iam_role.my_role.arn

  run_command_targets {
    key    = "tag:Name"
    values = ["FooBar"]
  }

  Inputs =  {
   SourceType= “S3”,
   SoureInfo = “[<url path to my bucket/file>]”,
   CommandLine = “powershell file.ps1”
  }
}

@SiSi2018 If you have access to CloudTrail, you can inspect the PutTargets event and see how the AWS API is invoked.

I did a quick test and I see that when configure target input is set to constant, it simply adds an object to the input parameter based on the other fields. Here is the request body when I added an echo command:

    "requestParameters": {
        "rule": "test",
        "eventBusName": "default",
        "targets": [
            {
                "id": "Id2cfdf156-b29f-4765-a0e8-9f5a8454964e",
                "arn": "arn:aws:ssm:us-east-1::document/AWS-RunShellScript",
                "roleArn": "arn:aws:iam::123456789012:role/service-role/Amazon_EventBridge_Invoke_Run_Command_238057371",
                "input": "{\"executionTimeout\":[\"3600\"],\"commands\":[\"echo \\\"hello world\\\"\"]}",
                "runCommandParameters": {
                    "runCommandTargets": [
                        {
                            "key": "tag:yo",
                            "values": [
                                "yoyo"
                            ]
                        }
                    ]
                }
            }
        ]
    },

On the other hand, leaving the setting as Matched events would simply not include the input parameter.

I couldn’t find any “schema” for the input for an SSM run command target in the API reference, so I guess the best way is to reference the CloudTrail event after you’ve created a target with the same parameter in the AWS Management Console.