boltops-tools / terraspace

Terraspace: The Terraform Framework
https://terraspace.cloud
Apache License 2.0
674 stars 46 forks source link

`--plugin none` fails on new project #343

Open stiliajohny opened 8 months ago

stiliajohny commented 8 months ago

Checklist

My Environment

Software Version
Operating System MacOS Sanoma 14.3
Terraform v1.5.7
Terraspace 0.6.23
Ruby 2.6.10p210 (2022-04-12 revision 67958)

Expected Behaviour

$ terraspace new project infra --plugin none --examples
=> Creating new project called infra.
      create  infra
      create  infra/.gitignore
       exist  infra
      create  infra/config/terraform/backend.tf
      create  infra/config/terraform/provider.tf
=> Creating new module called example.
      create  infra/app/modules/example
      create  infra/app/modules/example/main.tf
      create  infra/app/modules/example/outputs.tf
      create  infra/app/modules/example/variables.tf
=> Creating new stack called demo.
      create  infra/app/stacks/demo
      create  infra/app/stacks/demo/main.tf
      create  infra/app/stacks/demo/outputs.tf
      create  infra/app/stacks/demo/variables.tf
$ cd infra # and start checking out the files

Current Behavior

➜  terraspace git:(main) ✗ terraspace new project infra --plugin none --examples                                                                                                                                                           git:(main|-13…4 
=> Creating new project called infra.
      create  infra
      create  infra/.gitignore
      create  infra/Gemfile
      create  infra/README.md
      create  infra/Terrafile
      create  infra/config/app.rb
LoadError: cannot load such file -- terraspace_plugin_none
ERROR: Unable to require plugin terraspace_plugin_none.
Are you sure you the plugin exists and you specified the right plugin option.
You specified --plugin none                                                                                                                                                                                                                           
➜  terraspace git:(main) ✗   

Step-by-step reproduction instructions

Install terraspace as per documentation. I can do terraspace new project NAME and that works but when I need to terraspace init even after changing the provider to be a non AWS i get no AWS creds, My project is not AWS, its more of a bare metal infra ( Cloudflare, k8s ) Following the docs from here

Code Sample

file tree ```bash . ├── Gemfile ├── Gemfile.lock ├── README.md ├── Terrafile ├── app │   ├── modules │   └── stacks │   └── demo │   ├── main.tf │   ├── outputs.tf │   └── variables.tf └── config ├── app.rb └── terraform ├── backend.tf └── provider.tf 7 directories, 10 files ```
backend.tf ```bash terraform { backend "local" { path = "terraform.tfstate" } } ```
provider.tf ```bash terraform { required_providers { cloudflare = { source = "cloudflare/cloudflare" version = ">= 4.9.0" } random = { source = "hashicorp/random" } } required_version = ">= 0.13" } # Providers provider "cloudflare" { api_token = "XXXXXX" } provider "random" { } ```
terraspace init demo ```bash terraspace init demo git:(main|-13…4 Building .terraspace-cache/us-east-1/dev/stacks/demo INFO: You're missing AWS credentials. Only local services are currently available /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/plugin/expander/friendly.rb:7:in `friendly_name': undefined method `to_sym' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:93:in `block in plugins' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:87:in `each' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:87:in `plugins' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/layering.rb:11:in `main_layers' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/layering.rb:6:in `layers' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:62:in `full_layering' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:48:in `full_paths' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar/layer.rb:41:in `paths' from /Library/Ruby/Gems/2.6.0/gems/memoist-0.16.2/lib/memoist.rb:169:in `paths' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar.rb:24:in `layer_paths' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/strategy/tfvar.rb:9:in `run' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/builder.rb:30:in `build_tfvars' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/compiler/builder.rb:13:in `build' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/builder.rb:57:in `build_root_module' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/builder.rb:52:in `build_unresolved' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/builder.rb:22:in `block in run' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/hooks/builder.rb:25:in `run_hooks' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/hooks/concern.rb:6:in `run_hooks' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/builder.rb:20:in `run' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/cli/commander.rb:9:in `run' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/cli.rb:115:in `init' from /Library/Ruby/Gems/2.6.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run' from /Library/Ruby/Gems/2.6.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command' from /Library/Ruby/Gems/2.6.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/lib/terraspace/command.rb:61:in `dispatch' from /Library/Ruby/Gems/2.6.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start' from /Library/Ruby/Gems/2.6.0/gems/terraspace-0.6.23/exe/terraspace:14:in `' from /usr/local/bin/terraspace:23:in `load' from /usr/local/bin/terraspace:23:in `
' ```

Solution Suggestion