-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(pipelines): (Could not assume role in target account using current credentials) #29479
Comments
Looks like your pipeline role was trying to assume the Are you able to provide a minimal code snippet including the pipeline construct that we can reproduce it and see what's happening in our account? |
i have an update, we resolve this with the following selfMutationCodeBuildDefaults {
rolePolicy: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["sts:AssumeRole"],
resources: ["*"],
conditions: {
StringEquals: {
"iam:ResourceTag/aws-cdk:bootstrap-role": [
"deploy",
"file-publishing",
],
},
},
}),
],
} the pipeline now is this: new pipelines.CodePipeline(this, "pipeline", {
pipelineName: `${name}-${props.stage}`,
dockerEnabledForSynth: true,
crossAccountKeys: true,
synth: new pipelines.CodeBuildStep("synth", {
input: repoBackendSource,
commands: [
"npm ci",
`npx cdk synth -v ${namePipeline}`,
],
}),
selfMutationCodeBuildDefaults: {
rolePolicy: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["sts:AssumeRole"],
resources: ["*"],
conditions: {
StringEquals: {
"iam:ResourceTag/aws-cdk:bootstrap-role": [
"deploy",
"file-publishing",
],
},
},
}),
],
},
}); We use pipelines in aws-cdk-lib |
Generally, If your pipeline account A is trying to deploy resource on account B, you need to
|
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Describe the bug
My pipeline has a dedicated AWS account (accountA) while deployed resources have a dedicated AWS account (accountB). Up to this point, the pipeline was working properly. Adding a LambdaInvoke step to invoke a lambda in the account-b (cross-account) caused a problem in the pipeline.
Expected Behavior
Pipeline works
Current Behavior
In the update pipeline, the self-mutate task, I am encountering the following error:
Error: Could not assume role in target account using current credentials (which are for account ACCOUNT-A) User: arn:aws:sts::ACCOUNT-A:assumed-role/RolePipeline/AWSCodeBuild-XXXX is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::ACCOUNT-B:role/cdk-hnb659fds-deploy-role-ACCOUNTB-eu-west-1 . Please make sure that this role exists in the account. If it doesn't exist, (re)-bootstrap the environment with the right '--trust', using the latest version of the CDK CLI.
Reproduction Steps
I added this construct to my pipeline
Possible Solution
I've seen the similar issue #19686, but I don't think it's a lookup problem. I tried to insert the tag lookup and run cdk synth, but I don't have any cdk.context.json.
Maybe it's a misconfiguration problem. Can you help me?
Additional Information/Context
I deployed the pipeline using AWS cli to force an update, but it still isn't working.
I added trust relationship to account B lambda for account A.
CDK CLI Version
2.118.0
Framework Version
projen 0.79.10
Node.js Version
v18.18.2
OS
WSL Ubuntu
Language
TypeScript
Language Version
TypeScript
Other information
No response
The text was updated successfully, but these errors were encountered: