Skip to content
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

[BUG] Unable to create a new project with starter examples #363

Open
3 tasks done
bcsizmadia opened this issue Jan 6, 2025 · 0 comments
Open
3 tasks done

[BUG] Unable to create a new project with starter examples #363

bcsizmadia opened this issue Jan 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@bcsizmadia
Copy link

Checklist

  • Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System macOS 15.2
Terraform 1.10.3
Terraspace 2.2.17
Ruby ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]

Expected Behaviour

I expect to create a new terraspace project wit the starter examples.

Current Behavior

In an empty directory unable to create a new starter project.

Step-by-step reproduction instructions

  1. mkdir test_project
  2. cd test_project
  3. terraspace new project infra --plugin aws --examples

and it throws an error:

ERROR: It doesn't look like this is a terraspace project. Are you sure you are in a terraspace project?

Code Sample

It happens in

def check_project!(command_name)
return if subcommand?
return if command_name.nil?
return if help_flags.include?(Terraspace.argv.last) # IE: -h help
return if %w[-h -v --version check_setup completion completion_script help new setup test version].include?(command_name)
return if File.exist?("#{Terraspace.root}/config/app.rb")
return unless Terraspace.check_project
logger.error "ERROR: It doesn't look like this is a terraspace project. Are you sure you are in a terraspace project?".color(:red)
ENV['TS_TEST'] ? raise : exit(1)
end

the command_name is only project and not new as expected.

However in

check_project!(args.first)

if I do

puts args.first.inspect
check_project!(args.first)

I'll have 2 string "new" and "project" and in def check_project!(command_name) the command_name will be project and not new.

Solution Suggestion

As a low level solution add project to

return if %w[-h -v --version check_setup completion completion_script help new setup test version].include?(command_name)

PS

I know my Terraform version is too recent, but at this point this shouldn't be a problem.

@bcsizmadia bcsizmadia added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant