-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deletion of inline role policies (#4045)
In #3587 we introduced auto-naming for the inline role policies and added filtering of the inputs within a transformation. This didn't take the special case of removing all inline policies into consideration, which requires an empty object as the delete marker. Fixes #4031
- Loading branch information
1 parent
37cbce8
commit f9d0b01
Showing
7 changed files
with
149 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: regress-4031 | ||
runtime: | ||
name: python | ||
options: | ||
virtualenv: venv | ||
description: A minimal AWS Python Pulumi program to reproduce regression 4031 | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pulumi | ||
import pulumi_aws | ||
|
||
|
||
role = pulumi_aws.iam.Role( | ||
"test-role", | ||
assume_role_policy=pulumi_aws.iam.get_policy_document( | ||
statements=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementArgs( | ||
actions=["sts:AssumeRole"], | ||
principals=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementPrincipalArgs( | ||
type="Service", | ||
identifiers=["ecs-tasks.amazonaws.com"], | ||
), | ||
], | ||
), | ||
], | ||
).json, | ||
inline_policies=[ | ||
pulumi_aws.iam.RoleInlinePolicyArgs( | ||
name="bucket1", | ||
policy=pulumi_aws.iam.get_policy_document( | ||
statements=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementArgs( | ||
actions=["s3:GetObject"], | ||
resources=["arn:aws:s3:::bucket1/*"], | ||
), | ||
], | ||
).json, | ||
), | ||
pulumi_aws.iam.RoleInlinePolicyArgs( | ||
name="bucket2", | ||
policy=pulumi_aws.iam.get_policy_document( | ||
statements=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementArgs( | ||
actions=["s3:GetObject"], | ||
resources=["arn:aws:s3:::bucket2/*"], | ||
), | ||
], | ||
).json, | ||
), | ||
], | ||
) | ||
|
||
pulumi.export("roleName", role.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi-aws>=6.0.0,<7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pulumi | ||
import pulumi_aws | ||
|
||
|
||
role = pulumi_aws.iam.Role( | ||
"test-role", | ||
assume_role_policy=pulumi_aws.iam.get_policy_document( | ||
statements=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementArgs( | ||
actions=["sts:AssumeRole"], | ||
principals=[ | ||
pulumi_aws.iam.GetPolicyDocumentStatementPrincipalArgs( | ||
type="Service", | ||
identifiers=["ecs-tasks.amazonaws.com"], | ||
), | ||
], | ||
), | ||
], | ||
).json, | ||
inline_policies=[pulumi_aws.iam.RoleInlinePolicyArgs()] | ||
) | ||
|
||
pulumi.export("roleName", role.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters