cloudtools / cloudtools/troposphere
awacs.aws.Policy versus troposphere.Policy- how to add policies to a role?
- Dominant language
- Python
- Stars
- 4.9k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
Real confusion here... :(
Using:
troposphere 2.3.1
awacs 0.8.0
Installed with "pip install troposphere[policy]"
I am attempting to add multiple policies to a iam.role. I have tried several different varieties of coding this but I am unable to get this to work using awacs with troposphere.
```
from troposphere import Template
from troposphere.iam import Policy
from troposphere.iam import Role
from awacs.aws import PolicyDocument
from awacs.aws import Principal
from awacs.aws import Statement
self.role_snapshots = self.template.add_resource(
Role(
"Snapshots",
AssumeRolePolicyDocument=PolicyDocument(
Statement=[
Statement(
Effect=Allow,
Action=[
Action("sts", "AssumeRole")
],
Principal=Principal("Service", "lambda.amazonaws.com")
)
]
),
Policies=[
Policy(
PolicyName="inline_policy_snapshots_cw_logs",
PolicyDocument=PolicyDocument(
Id="inline_policy_snapshots_cw_logs",
Version="2012-10-17",
Statement=[
Statement(
Effect=Allow,
Action=[
Action("logs", "CreateLogGroup"),
Action("logs", "CreateLogStream"),
Action("logs", "PutLogEvents"),
],
Resource=["arn:aws:logs:*:*:*"]
)
]
)
),
]
)
)
```
Contributor guide
Assessment
This issue has not been assessed yet.