terraform-google-modules/terraform-google-vm

Allow custom instance index

thiagonache opened this issue · 4 comments

TL;DR

Currently the instance name always start with index 1 due to:

var.add_hostname_suffix ? format("%s%s%s", local.hostname, var.hostname_suffix_separator, format("%03d", count.index + 1)) : local.hostname

My idea is to receive a param (default to 1) that sets the number we add to compose the hostname.
Eg: I can set 0 to start with index 0 instance-000 or 4 to start with instance-004

Terraform Resources

Compute instances

Detailed design

Simply add a new variable to replace hardcoded 1.

Additional information

No response

I can code the PR for it.

What is the use case for this? It seems very niche and probably something you might want to constrain to your fork.

I agree it's very niche. My use case is that I need to mimic the same environment I have on-premises on GCP and my hostname starts with zeros. the idea of the variable is not change the current behavior. but I can keep my own fork if you don't think it's useful.

Yeah I think this probably is best kept to your fork.