-
Notifications
You must be signed in to change notification settings - Fork 459
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
Allowing to initiate (cdktf init) a project in an empty directory. #1697
Comments
Hi @ValAug 👋 This issue was about not being able to run |
Hello, That's correct. ERROR: Cannot initialize a project in a non-empty directory. Sorry that made a mistake in the issue title |
It looks like I have to delete what is created with the repo first then run cdktf init --template="typescript" for this work. Still seen to be a good opportunity to enhance the whole process. We should be able to init the project without needing to delete what is created by GitHub |
I just tried running |
Hello,
Thank you for the email.
I will break my steps below.
I created a folder locally for my project
I created a GitHub repo to host the project
I clone the repo in my project folder I created
Inside the the repo I ran CDKTF init and I received the error about not
empty directory.
As we know the repo comes with it own folders. What I did was to deleted
those folders and run CDKTF init again and that allows me to create the
project without error.
Which is a solution but this would mean that one will need to do the same
each time that clones a repo.
On Thu, Apr 7, 2022 at 11:18 PM Jon Steinich ***@***.***> wrote:
I just tried running git init followed by cdktf init and didn't run into
any problems.
I'm wondering if there is a README.md file being created with a new
project or potentially a LICENSE file. @ValAug <https://github.com/ValAug>
are either of those present or is there something else?
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2EDCCQ6LSLSJ7QAIL3VD6QO7ANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
Hi @ValAug, quick question: Do you create the new repo based on a template that already contains some kind of CDKTF project? (You wouldn't need to run |
No the repo is new(empty).
My intention was to create the project in this new repo.
On Fri, Apr 8, 2022 at 11:43 AM Ansgar Mertens ***@***.***> wrote:
Hi @ValAug <https://github.com/ValAug>, quick question: Do you create the
new repo based on a template that already contains some kind of CDKTF
project? (You wouldn't need to run cdktf init in that case, it is only
required to create a new project but not required to be run by e.g.
different team members after they cloned that existing project).
We could make the latter more clear by detecting whether there's already a
cdktf.json available and tell the user that they don't need to run init
like they'd have to do when using Terraform directly.
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2AB5SEGQL6V5SHBLTTVEBH2TANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
Unless there is some issue that we aren't aware of, you should have no problem running |
Hey Jon,
Thank you again for trying to make this happen.
As Ansgar mentioned a cloned repo contains a .git directory, so that might
be the underlying reason for this issue.
What I did was to remove the .git directory after cloning the new repo for
cdktf init to work.
Hopefully this makes things clearer.
Thank you again
On Fri, Apr 8, 2022 at 12:32 PM Jon Steinich ***@***.***> wrote:
Unless there is some issue that we aren't aware of, you should have no
problem running cdktf init in an empty directory.
@ValAug <https://github.com/ValAug> can you please run ls in the
directory that you are trying to run cdktf init and let us know what it
shows?
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2ADBPXELH3FI3TAPJLVEBNTBANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
What's strange is that I don't have any issues with this locally. I also can see the code which should already ignore a
@ValAug what OS are you using? |
I’m Mac user and I use VsCode.
Could you please share your process?
On Sun, Apr 10, 2022 at 4:48 PM Jon Steinich ***@***.***> wrote:
What's strange is that I don't have any issues with this locally. I also
can see the code which should already ignore a .git directory:
https://github.com/hashicorp/terraform-cdk/blob/2dba175c527d30daef6d623f701a950b4350afb8/packages/cdktf-cli/bin/cmds/helper/init.ts#L37
@ValAug <https://github.com/ValAug> what OS are you using?
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2DR4NDYDMVK3ZYXTPDVEM475ANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
|
Interesting.
I am assuming this is the only possible way for CDKTF init to work.
Is there a possible opportunity to be able to clone a brand new repo and
initiate the CDKTF project in the future without receiving the
error message that I am receiving ?
Thank again for your time and help Jon
On Sun, Apr 10, 2022 at 5:00 PM Jon Steinich ***@***.***> wrote:
mkdir 1697
cd 1697
git init
cdktf init
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2HSWFKX6KHI2ZG3GY3VEM6PNANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
Absolutely. I'm just trying to get to the bottom of what's different with your process/environment. Cloning an empty git repo will have a I've tried both Linux and Windows without issue, but I'm unable to check on Mac. @ansgarm can you try this out please? |
@jsteinich worked for me as well on OS X:
|
Great!
Had you try reproducing my use case?
Thanks
On Mon, Apr 11, 2022 at 8:28 AM Ansgar Mertens ***@***.***> wrote:
@jsteinich <https://github.com/jsteinich> worked for me as well on OS X:
> mkdir test-git-init
> cd test-git-init
> git init
Initialized empty Git repository in /Users/ansgar/projects/playground/test-git-init/.git/
> ls -lAh
total 0
drwxr-xr-x 9 ansgar staff 288B Apr 11 14:23 .git
> cdktf --version
0.10.1
> cdktf init --local
# worked
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2FKEKFGWSOZB4CFEN3VEQLFZANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
Hi @ValAug, |
Hello,
https://github.com/ValAug/cdktf-demo.git
cdktf init --template="typescript" --local
ERROR: Cannot initialize a project in a non-empty directory
ls -a
. .. .git README.md
Thank you
Augusto
…On Tue, Apr 12, 2022 at 9:33 AM Ansgar Mertens ***@***.***> wrote:
Hi @ValAug <https://github.com/ValAug>,
could you create and link a public Github repo (which shows this behaviour
after cloning) that I can clone to try to reproduce it locally on my
machine?
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2HOBLOCLPVEAN3Z4LTVEV3TDANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
*Thank you*
*Augusto Valdivia*
*Cloud Architect *
*augustovaldivia.ca <http://augustovaldivia.ca>*
|
In that example the problem is |
While we could ignore a |
Is this a no for the enhancement?
On Wed, Apr 13, 2022 at 4:21 AM Ansgar Mertens ***@***.***> wrote:
While we could ignore a README.md, we wouldn't be able to make this
proposed change: #1315
<#1315> without e.g.
asking the user whether overwrite that file 😇
—
Reply to this email directly, view it on GitHub
<#1697 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7XK2AZ4BFGP3NGMGVINATVEZ7YNANCNFSM5SZS6HLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Augusto Valdivia
|
Hi @ValAug, no, that's no decision yet. I rather wanted to link to the other issue this proposal might collide with, to make sure we take that into consideration. To me it would be perfectly fine to allow e.g. a |
…E.md When creating a new Git repository via Github one can easily add a README.md resulting in an non-empty new git repo in which cdktf init won't work then Related to #1697
I recently came across this problem while trying cdktf out, and it begs the question; why can't it |
Hi @tgmatt, the cdktf-cli currently uses node-sscaff for the different templates we support (and for user defined "remote" templates) and that library does not currently support checking whether files exist (it will just overwrite them). While we could technically solve this for static files in the template, it would be harder for files that are written programmatically via the Maybe extending our list of allowed files (currently |
Hi there! 👋 We haven't heard from you in 30 days and would like to know if the problem has been resolved or if you still need help. If we don't hear from you before then, I'll auto-close this issue in 30 days. |
I'm closing this issue because we haven't heard back in 60 days. ⌛️ If you still need help, feel free to comment or reopen the issue! |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
References
The text was updated successfully, but these errors were encountered: