I have created an iam role with troposphere but getting a circular dependency error when provisioning the resource with Cloudformation. My iam role has a trust policy to assume its own arn and I think the circular dependency error is due to the role is not created and doesn't know the arn to update the trust policy. Any ideas are welcome to resolve this issue
troposphere.iam.Role(
'newiamrole',
template=template,
Path='/',
AssumeRolePolicyDocument=awacs.aws.Policy(
Statement=[
awacs.aws.Statement(
Effect=awacs.aws.Allow,
Action=[awacs.sts.AssumeRole],
Principal=awacs.aws.Principal(
'Service', ['ec2.amazonaws.com'])
),
awacs.aws.Statement(
Effect=awacs.aws.Allow,
Action=[awacs.sts.AssumeRole],
Principal=awacs.aws.Principal(
'AWS', [troposphere.GetAtt('newiamrole', 'Arn')])
)
]
)
)