-
Notifications
You must be signed in to change notification settings - Fork 428
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
fix(cli): make env init idempotent #763
Conversation
Manual TestSuppose we already have environment "test" set up and accidentally deleted it from SSM. Then if I run
Also tested if remove the CFN stack.
|
6508e8f
to
0914d3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you! A suggestion below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! One question about projects, though.
@@ -135,11 +134,7 @@ func (o *initProjectOpts) Execute() error { | |||
Domain: o.DomainName, | |||
}) | |||
if err != nil { | |||
// If the project already exists, move on - otherwise return the error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this is interesting. Anyway, no matter what we do - we should move the creation of the project in SSM to after all the CloudFormation stack creation/updating.
Same with the workspace file writing.
I think up here, we should then check to see if the project already exists in SSM and bail out (or ask if you want to use the existing project demo
and then write the workspace files).
I'm imagining a situation like this:
- Efe creates a project called demo with --domain efeiscool.cool
- PH wants to create a demo project as well, but with --domain phiscool.cool
With the current code, I think that will work and Efe's project's configuration will get overwritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question! Never thought about the case when more then one ppl working on the same project. I guess in the scenario you put, when PH want to create a demo project, if they are using the same AWS account, the CLI should do a check first if it exists in the SSM already. This can also be applied to env init
/app init
.
Fix #301, partially addressing #660.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.