Skip to content

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

@bcsizmadia

Description

@bcsizmadia

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions