boltops-tools / terraspace

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

Terraspace fmt don't work on modules #116

Closed ByJacob closed 3 years ago

ByJacob commented 3 years ago

Checklist

My Environment

Software Version
Operating System linux
Terraform 0.14.6
Terraspace 0.6.9
Ruby ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

Expected Behaviour

Code in modules are formated

Current Behavior

Code in modules are don't formated

Step-by-step reproduction instructions

  1. Download Sample codes
  2. Execute terraspace fmt
  3. Command format stacks, but don't format modules

Code Sample

https://github.com/ByJacob/terraspace-bug-issues-116

Solution Suggestion

tongueroo commented 3 years ago

By default, only app/stacks are formatted by terraspace fmt. Can format modules also with a flag:

terraspace fmt -t module

Terraspace Docs: terraspace fmt

Can also get help from the CLI

terraspace fmt -h
ByJacob commented 3 years ago

Haven't seen it before. My mistake :( Why isn't all the default?

ByJacob commented 3 years ago

I checked this command and all is not working. I using prepared sample code.

Workspace/GitHub/terraspace-bug-issues-116/sample$ terraspace fmt -t all
Formating terraform files

Workspace/GitHub/terraspace-bug-issues-116/sample$ terraspace fmt -t module
Formating terraform files
app/modules/mod1
main.tf

Workspace/GitHub/terraspace-bug-issues-116/sample$ terraspace fmt -t stack
Formating terraform files
app/stacks/test1
main.tf
tongueroo commented 3 years ago

Sure. There was a bug in with the -t all option. It was fixed in #117 as reference above ⬆️ Thanks!