I have figure out a workable solution. I have moved the content out into an external file and I am now using templatefile to read in the file so that I can update the variables.
policy = templatefile("${path.module}/s3_bucket_policy.tpl", {
s3_arn = aws_s3_bucket.b.arn
})
Cheers