How to use terraform-docs with no modules (only root module)?

I have been trying to use terraform-docs with a Terraform sample infrastructure which is not organized into modules, so it only has the root module (as we read in modules docs). I started by installing terraform-docs with go get, according to the instructions on GitHub. The terraform-docs syntax to generate markdown docs is terraform-docs markdown ./my-terraform-module. If I try to pass a .tf file as argument, I get:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x79eb84]

goroutine 1 [running]:
github.com/terraform-docs/terraform-docs/internal/cli.(*cfgreader).exist(0xc000156000, 0xc000156000, 0x2, 0xc000018e80)
    /home/username/go/pkg/mod/github.com/terraform-docs/terraform-docs@v0.10.0-rc.1/internal/cli/reader.go:22 +0xe4
github.com/terraform-docs/terraform-docs/internal/cli.PreRunEFunc.func1(0xc0000b1b80, 0xc00014c1f0, 0x1, 0x1, 0x0, 0x0)
    /home/username/go/pkg/mod/github.com/terraform-docs/terraform-docs@v0.10.0-rc.1/internal/cli/run.go:46 +0x1b9
github.com/spf13/cobra.(*Command).execute(0xc0000b1b80, 0xc00014c1d0, 0x1, 0x1, 0xc0000b1b80, 0xc00014c1d0)
    /home/username/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:831 +0x514
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000b0dc0, 0x43c027, 0xba3e80, 0xc000012090)
    /home/username/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
    /home/username/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/terraform-docs/terraform-docs/cmd.Execute(0x4ae00, 0xc00001e238)
    /home/username/go/pkg/mod/github.com/terraform-docs/terraform-docs@v0.10.0-rc.1/cmd/root.go:24 +0x2b

When I pass the files directory as argument, I get a markdown output containing only the requirements, providers and input section only contains variables and their values. So, I ask: is it possible to use terraform-docs with the root module?

Thanks in advance

Go to Source
Author: rtrigo

Naming problem helperpluginservice

I am looking for some service or plugin which can help with naming problem. Something that check consistency or checks for a verb in method names. May be suggesting how to shorten the name (which is not trivial for non native speakers). I’ve heard of code summarization researches. I don’t know will it solve such problem or not, but if it is, it would be interesting to look at such solution.

Go to Source
Author: Yaroslav Kishchenko

How to automate the key exchange in WireGuard when you deploy a cluster of machines?

Let’s assume you want to deploy a cluster of machines on Hetzer Cloud. For simplicity let’s call them worker1, worker2, worker3. They need to communicate with a server called master, which will be running on different account then the workers. Ideally, the whole setup should not be open to the internet. Unfortunately, Hetzner supports only private networks within the same account.

To make it work, you can setup your own VPN using WireGuard. Conceptually, it is not hard. You need to setup three connections (between the master and each worker). The tricky part is how to automate the key exchange. Ideally, it should not be more work if you deploy additional workers (e.g. 100 instead 3 workers).

Setting up such a VPN cluster sounds like a common problem, but I cannot find any recommendations on how to setup 1-to-n or n-to-m connections, only tutorials on how to peer two machines. I’m thinking of automating the key exchange with Ansible (generate keys, gather them, install them on the master), but wanted to check first whether there is an easier solution to the problem that I missed.

In SSH, workers could share their key, which would simplify the problem. In WireGuard, keys cannot be shared, as far as I understood. How would you automate the setup of a VPN with WireGuard, so each worker can reach the master? Or is WireGuard the wrong choice for the problem?

Clarification:

  • In my scenario, it is not possible to move the workers and master to the same account; otherwise, Hetzner networks would be the straightforward solution for setting up a private network.
  • If you are not familiar with Hetzner Cloud, it is not a problem. You can assume that you get normal Linux machines, but then you are on your own (it does not support VPC peering across accounts as AWS does). Yet you can use all Linux tools available for creating the VPN setup. WireGuard would be my first choice, but I’m open to other techniques.

Go to Source
Author: Philipp Cla├čen