fix: Check to see if an application exists globally before creating it #4113
fix: Check to see if an application exists globally before creating it #4113mergify[bot] merged 16 commits intoaws:mainlinefrom
Conversation
paragbhingre
left a comment
There was a problem hiding this comment.
Overall looks good 😎 I just have a question and a suggestion.
Are we actually checking anywhere that application does exist in the SSM? |
|
So just trying to understand the flow here. So currently we create admin-role and then add application to SSM? Is that why we are specifically checking if SSM doesn't have the application and admin-role exist before erroring out? |
Yes, when you are trying to deploy an application we create |
Codecov Report
@@ Coverage Diff @@
## mainline #4113 +/- ##
============================================
+ Coverage 69.27% 69.29% +0.02%
============================================
Files 250 250
Lines 35887 35919 +32
Branches 264 264
============================================
+ Hits 24861 24891 +30
- Misses 9834 9837 +3
+ Partials 1192 1191 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Lou1415926
left a comment
There was a problem hiding this comment.
Looks good! Just some nits around the recommendations!
|
🍕 Here are the new binary sizes!
|
Lou1415926
left a comment
There was a problem hiding this comment.
The tests LGTM but why is the coverage dropping 😭
aws#4113) This PR resolves aws#815 For example, if you run `copilot app init my-proj` in `us-east-1`, then run `copilot app init my-proj` in `us-west-2` the second init will fail. This happens because CloudFormation creates an adminrole for the application of the form `{app-name}-adminrole`. CloudFormation can't create two roles with the same name since roles are global. Currently, CloudFormation errors out saying failed to create: [AdministrationRole] `stack {app-name}-infrastructure-roles did not complete successfully and exited with status ROLLBACK_COMPLETE` This PR will do the following 1. Check to see if the application name exists in SSM 2. If it doesn't, check to see if the role exists 3. If the role exists, but the application doesn't exist shows an error: `application named {app-name} already exists in another region` Case 1: If you run `copilot app init test-project` in `us-east-1` and If run `copilot app init test-project `in `us-west-2` Then an error message shows `application named test-project already exists in another region` Case 2: If there is already a role existing in the account with same name as `applicationname-adminrole` then we will error out `IAM admin role {applicationname}-adminrole already exists in this account` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
This PR resolves #815
For example, if you run
copilot app init my-projinus-east-1, then runcopilot app init my-projinus-west-2the second init will fail.This happens because CloudFormation creates an adminrole for the application of the form
{app-name}-adminrole. CloudFormation can't create two roles with the same name since roles are global.Currently, CloudFormation errors out saying
failed to create: [AdministrationRole]
stack {app-name}-infrastructure-roles did not complete successfully and exited with status ROLLBACK_COMPLETEThis PR will do the following
application named {app-name} already exists in another regionCase 1:
If you run
copilot app init test-projectinus-east-1and If runcopilot app init test-projectinus-west-2Then an error message showsapplication named test-project already exists in another regionCase 2:
If there is already a role existing in the account with same name as
applicationname-adminrolethen we will error outIAM admin role {applicationname}-adminrole already exists in this accountBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.