-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy Cabana's assets to an AWS account with OIDC authentication, no saved credentials #7
Comments
TODO
|
When I add the Conditions to the Role that my Provider will assume, similar to these: "Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
"token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:ref:refs/heads/octo-branch"
}
} I can determine the org ( |
Do I need to make sure that the role exists when they deploy the app stack? I think not. I think Rolename or equivalent consistent logic (maybe stackname("role") plus querying the output) will make sure that I can use the same name when I deploy it and when I refer to it in the Action (same repo). I need to revisit the process of having one step in my Action where I figure the role name and one step (the Marketplace OIDC Action, configure-credentials or whatever) where I specify it. Should the role stack be in a separate app in the same repo? One role per repo (org and repo name), right? Not one per branch? It would be annoying to have to run a CLI command to deploy the role once once for every branch. |
A role per branch is fine, actually. |
#7 The last few commits have pertained to the above issue.
#7 Looks like this permissions object is required. aws-actions/configure-aws-credentials#271 (comment) Also shown in the second code sample here: https://github.com/aws-actions/configure-aws-credentials#usage
#7 My last build failed with Error: Not authorized to perform sts:AssumeRoleWithWebIdentity This is a long-shot guess inspired by aws-actions/configure-aws-credentials#318 (comment) that somehow StringLike with no wildcards doesn't work.
Not sure what to do about this.
{
"eventVersion": "1.08",
"userIdentity": {
"type": "WebIdentityUser",
"principalId": "arn:aws:iam::105379901447:oidc-provider/token.actions.githubusercontent.com:sts.amazonaws.com:repo:VerticalRelevance/cabana:ref:refs/heads/master",
"userName": "repo:VerticalRelevance/cabana:ref:refs/heads/master",
"identityProvider": "arn:aws:iam::105379901447:oidc-provider/token.actions.githubusercontent.com"
},
"eventTime": "2023-08-09T17:58:17Z",
"eventSource": "sts.amazonaws.com",
"eventName": "AssumeRoleWithWebIdentity",
"awsRegion": "us-west-2",
"sourceIPAddress": "40.75.123.241",
"userAgent": "aws-sdk-nodejs/2.1396.0 linux/v16.16.0 configure-aws-credentials-for-github-actions promise",
"errorCode": "AccessDenied",
"errorMessage": "An unknown error occurred",
"requestParameters": {
"roleArn": "arn:aws:iam::105379901447:role/sVcmas-bbd933-role-GitHubRoleECD51173-89CYB55967ID",
"roleSessionName": "GitHubActions",
"durationSeconds": 3600
},
"responseElements": null,
"requestID": "5d1f77eb-b21e-4728-9eb2-76321690ddc4",
"eventID": "cad771e1-5ea0-495b-85a8-8dd6da571b19",
"readOnly": true,
"resources": [
{
"accountId": "105379901447",
"type": "AWS::IAM::Role",
"ARN": "arn:aws:iam::105379901447:role/sVcmas-bbd933-role-GitHubRoleECD51173-89CYB55967ID"
}
],
"eventType": "AwsApiCall",
"managementEvent": true,
"recipientAccountId": "105379901447",
"eventCategory": "Management",
"tlsDetails": {
"tlsVersion": "TLSv1.2",
"cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
"clientProvidedHostHeader": "sts.us-west-2.amazonaws.com"
}
} |
gh-7 Still trying to get rid of the error: Error: Not authorized to perform sts:AssumeRoleWithWebIdentity I can see example repos that work, and the only apparent difference is they have a wildcard as is added here. This is not an acceptable long-term solution, because I want to use GitHub's branch control rules to restrict who can deploy to the account associated with the master branch.
gh-7 It's sts.amazonaws.com, not sts.amazon.com!
I fixed the above by changing my condition on the |
I think I need to do this. I need to figure out the role name in one step, then write it to a GITHUB_ENV file so I can use it in the configure-credentials step. Update: Based on this example, GITHUB_ENV might not work, since I need to use the value in |
I could just have people deploy the role stack from the CLI, and save like |
gh-7 My last build failed with: Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers But an example here: https://github.com/aws-actions/configure-aws-credentials#assumerole-with-static-iam-credentials-in-repository-secrets has the role-to-assume pulled from a Secret.
Resources deployed, closing. |
Use https://github.com/VerticalRelevance/aws-github-oidc to ensure that an OIDC Provider is present in the account.
The text was updated successfully, but these errors were encountered: