-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Override functionality enabled for Root stack (#7702)
* feat: initial commit * feat: root stack creation on init with cdk * feat: enable for push * feat: added build command for root stack override * fix: authrole and Unauthrole Names * feat: added synthesizer and address comments * feat: added hash for root stack * feat: deploy root stack to disk * feat: updated amplifyMeta after root override * feat: update curren-cloud-backend * feat: refractor Root transform and added unit tests * fix: removes Template from Cloudform * feat: added build step in overrides
- Loading branch information
Showing
21 changed files
with
1,546 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Command to transform CFN with overrides | ||
*/ | ||
const subcommand = 'build-overrides'; | ||
|
||
module.exports = { | ||
name: subcommand, | ||
run: async context => { | ||
try { | ||
const { | ||
parameters: { options }, | ||
} = context; | ||
await context.amplify.executeProviderUtils(context, 'awscloudformation', 'buildOverrides', { | ||
forceCompile: true, | ||
}); | ||
} catch (error) { | ||
context.print.error(error.message); | ||
|
||
if (error.stack) { | ||
context.print.info(error.stack); | ||
} | ||
|
||
context.usageData.emitError(error); | ||
process.exitCode = 1; | ||
} | ||
}, | ||
}; |
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
161 changes: 161 additions & 0 deletions
161
...dformation/src/__tests__/root-stack-builder/__snapshots__/root-stack-builder.test.ts.snap
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,161 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Check RootStack Template generates root stack Template 1`] = ` | ||
Object { | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Root Stack for AWS Amplify CLI", | ||
"Outputs": Object { | ||
"AuthRoleArn": Object { | ||
"Value": Object { | ||
"Fn::GetAtt": Array [ | ||
"AuthRole", | ||
"Arn", | ||
], | ||
}, | ||
}, | ||
"Region": Object { | ||
"Description": "CloudFormation provider root stack Region", | ||
"Export": Object { | ||
"Name": Object { | ||
"Fn::Sub": "\${AWS::StackName}-Region", | ||
}, | ||
}, | ||
"Value": Object { | ||
"Ref": "AWS::Region", | ||
}, | ||
}, | ||
"StackId": Object { | ||
"Description": "CloudFormation provider root stack name", | ||
"Export": Object { | ||
"Name": Object { | ||
"Fn::Sub": "\${AWS::StackName}-StackId", | ||
}, | ||
}, | ||
"Value": Object { | ||
"Ref": "AWS::StackId", | ||
}, | ||
}, | ||
"StackName": Object { | ||
"Description": "CloudFormation provider root stack ID", | ||
"Export": Object { | ||
"Name": Object { | ||
"Fn::Sub": "\${AWS::StackName}-StackName", | ||
}, | ||
}, | ||
"Value": Object { | ||
"Ref": "AWS::StackName", | ||
}, | ||
}, | ||
"UnAuthRoleArn": Object { | ||
"Value": Object { | ||
"Fn::GetAtt": Array [ | ||
"UnauthRole", | ||
"Arn", | ||
], | ||
}, | ||
}, | ||
}, | ||
"Parameters": Object { | ||
"AuthRoleName": Object { | ||
"Default": "AuthRoleName", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
"DeploymentBucketName": Object { | ||
"Default": "DeploymentBucket", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
"UnauthRoleName": Object { | ||
"Default": "UnAuthRoleName", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
}, | ||
"Resources": Object { | ||
"AuthRole": Object { | ||
"Properties": Object { | ||
"AssumeRolePolicyDocument": Object { | ||
"Statement": Array [ | ||
Object { | ||
"Action": "sts:AssumeRoleWithWebIdentity", | ||
"Effect": "Deny", | ||
"Principal": Object { | ||
"Federated": "cognito-identity.amazonaws.com", | ||
}, | ||
"Sid": "", | ||
}, | ||
], | ||
"Version": "2012-10-17", | ||
}, | ||
"RoleName": Object { | ||
"Ref": "AuthRoleName", | ||
}, | ||
}, | ||
"Type": "AWS::IAM::Role", | ||
}, | ||
"DeploymentBucket": Object { | ||
"DeletionPolicy": "Retain", | ||
"Properties": Object { | ||
"BucketName": Object { | ||
"Ref": "DeploymentBucketName", | ||
}, | ||
}, | ||
"Type": "AWS::S3::Bucket", | ||
"UpdateReplacePolicy": "Retain", | ||
}, | ||
"UnauthRole": Object { | ||
"Properties": Object { | ||
"AssumeRolePolicyDocument": Object { | ||
"Statement": Array [ | ||
Object { | ||
"Action": "sts:AssumeRoleWithWebIdentity", | ||
"Effect": "Deny", | ||
"Principal": Object { | ||
"Federated": "cognito-identity.amazonaws.com", | ||
}, | ||
"Sid": "", | ||
}, | ||
], | ||
"Version": "2012-10-17", | ||
}, | ||
"RoleName": Object { | ||
"Ref": "UnauthRoleName", | ||
}, | ||
}, | ||
"Type": "AWS::IAM::Role", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`Check RootStack Template rootstack template generated by constructor 1`] = ` | ||
Object { | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Root Stack for AWS Amplify CLI", | ||
} | ||
`; | ||
|
||
exports[`Check RootStack Template rootstack template generated by constructor with some parameters 1`] = ` | ||
Object { | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Root Stack for AWS Amplify CLI", | ||
"Parameters": Object { | ||
"AuthRoleName": Object { | ||
"Default": "AuthRoleName", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
"DeploymentBucketName": Object { | ||
"Default": "DeploymentBucket", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
"UnauthRoleName": Object { | ||
"Default": "UnAuthRoleName", | ||
"Description": "Name of the common deployment bucket provided by the parent stack", | ||
"Type": "String", | ||
}, | ||
}, | ||
} | ||
`; |
Oops, something went wrong.