Created
February 7, 2020 23:02
-
-
Save Jeffwan/616d400d8b9f89017b46216634485c03 to your computer and use it in GitHub Desktop.
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
assumeRolePolicyDocument := []byte( | |
`{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Federated": "$(roleArn)" | |
}, | |
"Action": "sts:AssumeRoleWithWebIdentity", | |
"Condition": { | |
"StringEquals": { | |
"$(oidcProvider):aud": "sts.amazonaws.com", | |
"$(oidcProvider):sub": "system:serviceaccount:$(namespace):$(ksa)" | |
} | |
} | |
} | |
] | |
}`) | |
assumeRolePolicyDocument = bytes.Replace(assumeRolePolicyDocument, []byte("$(roleArn)"), []byte(oidcProviderArn), -1) | |
assumeRolePolicyDocument = bytes.Replace(assumeRolePolicyDocument, []byte("$(oidcProvider)"), []byte(issuerUrlWithProtocol), -1) | |
assumeRolePolicyDocument = bytes.Replace(assumeRolePolicyDocument, []byte("$(namespace)"), []byte(namespace), -1) | |
assumeRolePolicyDocument = bytes.Replace(assumeRolePolicyDocument, []byte("$(ksa)"), []byte(ksa), -1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment