Update IAM Assume role policy document

Hi,
I want to create a role, attach policies to it and create SF catalog integration and copy the IAM role and external id from the output of SF catalog resource and update the policy document ( assume role / trust ) on the IAM role.
Is there a way to do this dynamically ?

Thanks,
Poornima