-
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.
Pass Session Tags to credential validation check (#4862)
The provider wasn't sending the session tags when validating credentials. This caused perpetual credential check failures if users used the tags for enforcing access. This change fixes that. Fixes #4849
- Loading branch information
1 parent
d0ed212
commit bd51234
Showing
4 changed files
with
172 additions
and
0 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
75 changes: 75 additions & 0 deletions
75
provider/test-programs/assume-role-session-tags/Pulumi.yaml
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,75 @@ | ||
name: assume-role-session-tags | ||
runtime: yaml | ||
|
||
variables: | ||
awsAccount: | ||
fn::invoke: | ||
function: aws:getCallerIdentity | ||
currentRole: | ||
fn::invoke: | ||
function: aws:iam:getSessionContext | ||
arguments: | ||
arn: ${awsAccount.arn} | ||
|
||
resources: | ||
bootstrapProvider: | ||
type: pulumi:providers:aws | ||
|
||
iamRole: | ||
type: aws:iam:Role | ||
properties: | ||
assumeRolePolicy: | ||
fn::toJSON: | ||
Version: "2012-10-17" | ||
Statement: | ||
- Action: | ||
- "sts:AssumeRole" | ||
- "sts:TagSession" | ||
Effect: "Allow" | ||
Principal: | ||
AWS: ${currentRole.issuerArn} | ||
Condition: | ||
StringEquals: | ||
"aws:RequestTag/Repository": | ||
- "my-org/my-repo" | ||
inlinePolicies: | ||
- name: "inline-policy" | ||
policy: | ||
fn::toJSON: | ||
Version: "2012-10-17" | ||
Statement: | ||
- Action: | ||
- "s3:*" | ||
Effect: "Allow" | ||
Resource: "*" | ||
options: | ||
provider: ${bootstrapProvider} | ||
|
||
# IAM has a delay in propagating the new role, so we need to wait for it to be available | ||
# AWS is aiming for P99 below 2s so 6s should be enough | ||
wait6s: | ||
type: time:Sleep | ||
properties: | ||
createDuration: 6s | ||
|
||
provider: | ||
type: pulumi:providers:aws | ||
properties: | ||
assumeRole: | ||
roleArn: ${iamRole.arn} | ||
sessionName: "session-tagging-test" | ||
tags: | ||
Repository: "my-org/my-repo" | ||
options: | ||
dependsOn: | ||
- ${wait6s} | ||
|
||
myTestBucket: | ||
type: aws:s3:Bucket | ||
options: | ||
provider: ${provider} | ||
|
||
outputs: | ||
bucketArn: ${myTestBucket.arn} | ||
roleId: ${iamRole.id} | ||
roleARN: ${iamRole.arn} |