I have a terraform file that I'm reusing to create several AWS Eventbridge (as triggers for some lambdas).
On a different part of the file I'm able to use For Each
method to create several eventbridge and naming them accordingly. My problem is that I'm not being able to do the same thing inside EOF tag (that need to be different on each Eventbridge) since it takes everything as a string.
I would need to replace the ARN in "prefix": "arn:aws:medialive:us-west-2:11111111111:channel:3434343"
with a variable. How could I do that?
This is the EOF part of the terraform code:
event_pattern = <<EOF
{
"source": ["aws.medialive"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["medialive.amazonaws.com"],
"eventName": ["StopChannel"],
"responseElements": {
"arn": [{
"prefix": "arn:aws:medialive:us-west-2:11111111111:channel:3434343"
}]
}
}
}
EOF
}