Open nagkumar opened 2 years ago
new ProjectStack(app, "ProjectStack", StackProps.builder().env( Environment.builder() .account("projectStack") .region("ap-south-1") .build()).build());
This code is using a special account projectStack
, better to use
public static final Environment makeEnv()
{
return Environment.builder()
.account(System.getenv("CDK_DEFAULT_ACCOUNT"))
.region(System.getenv("CDK_DEFAULT_REGION"))
.build();
}
In any case, readme.md should say how to create projectStack account with what kind of privileges etc.. Also, this example also needs some commit directory etc.. not sure SampleProject should pre-exist etc..in Code Commit.. Better readme.md would help a lot.
IRole role =
Role.fromRoleArn(this, "someId", "arn:partition:service:region:account-id:resource-type:resource-id");
Looks like this line arn part also needs to be changed for this code to work, looked at class com.myorg.ProjectStack
Readme.md should contain the changes needed to such code
error reported for reference is
ProjectStack | 0/3 | 4:48:39 pm | CREATE_FAILED | AWS::CodeBuild::Project | SampleProject (SampleProject086B1A88) Invalid service role (Service: AWSCodeBuild; Status Code: 400; Error Code: InvalidInputException; Request ID: 1a0c31ef-7a83-4fbf-be4c-88f516cc9d1b; Proxy: null)
ProjectStack | 0/3 | 4:48:40 pm | CREATE_FAILED | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) Resource creation cancelled
ProjectStack | 0/3 | 4:48:41 pm | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | ProjectStack The following resource(s) failed to create: [SampleProject086B1A88, CDKMetadata]. Rollback requested by user.
Describe the bug
To run https://github.com/aws-samples/aws-cdk-examples/tree/master/java/codebuild examples bootstraping should be done in certain way, that command is not present in readme.md
Expected Behavior
command to boot strap this project should be mentioned properly in readme.md
Current Behavior
iac\aws\cdk\java\codebuild\project> cdk bootstrap --trust projectStack --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://projectStack/ap-south-1 ⏳ Bootstrapping environment aws://projectStack/ap-south-1... ❌ Environment aws://projectStack/ap-south-1 failed bootstrapping: Error: Need to perform AWS calls for account projectStack, but the current credentials are for 132462119873 at SdkProvider.forEnvironment (d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\api\aws-auth\sdk-provider.ts:184:60) at Function.lookup (d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\api\bootstrap\deploy-bootstrap.ts:31:18) at Bootstrapper.modernBootstrap (d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\api\bootstrap\bootstrap-environment.ts:81:21) at d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\cdk-toolkit.ts:621:24 at async Promise.all (index 0) at CdkToolkit.bootstrap (d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\cdk-toolkit.ts:618:5) at initCommandLine (d:\Apps\Dev\langs\scripting\js\Node\18.x\18.9.0\node_modules\aws-cdk\lib\cli.ts:349:12)
Need to perform AWS calls for account projectStack, but the current credentials are for 132462119873
Reproduction Steps
go to iac\aws\cdk\java\codebuild\project folder and run deploy it gives the above error
Possible Solution
proper documentation in readme.md
Additional Information/Context
No response
CDK CLI Version
'2.43.1'
Framework Version
No response
Node.js Version
18
OS
windows 10
Language
Java
Language Version
jdk18