F5Networks / terraform-gcp-bigip-module

Terraform module for Deploying BIG-IP in GCP
Apache License 2.0
9 stars 13 forks source link

VM name always contains f5vm01 - cannot be modified other than prefix #3

Closed JeffGiroux closed 2 years ago

JeffGiroux commented 3 years ago

The line to set name on the VM linux resource has "f5vm01" then appended to prefix. This is not helpful in all situations as it means the VM name will always have 'f5vm01' in it. It's best to have an option for f5vm01+prefix OR... a value that is passed by user as the entire name. If a var.instance_name (for example) is passed then use that value instead.

In reference to...

resource "google_compute_instance" "f5vm01" {
  name = format("%s-f5vm01", local.instance_prefix)
memes commented 3 years ago

Adding my 2c as well; I think the '-f5vm01' suffix should be removed entirely and allow the full name to be overridden.

Customers have specific naming conventions

These customers should be able to provide a full name that overrides the generated prefix + suffix name, and customer takes responsibility for ensuring unique names.

e.g.

module "bigips" {
  for_each = toset(["f5-ext-prod-01", "f5-ext-prod-02"])
  name = each.value
  ...
}

or at least allow override of the suffix

module "bigips" {
  for_each = range(1, 3)
  prefix = "f5-ext-prod"
  suffix = format("%02d", each.value)
  ...
}

The defaults can still provide uniqueness for count use-cases.

VM name constraint and FQDN

VM name is limited to 63 characters; adding '-f5vm01' to every VM name is redundant and wasteful of 11% of the available characters (almost 20% if the full random suffix is included '-XXXX-f5vm01').

This is even more of an issue when it comes to applying a hostname in DO; a common pattern is to use runtime-init to retrieve the FQDN from metadata server and apply it as a variable in DO declaration. Since the default FQDN will be PREFIX-XXXX-f5vm01.ZONE.c.PROJECT_ID.internal, the longer the generated VM name is, the more likely the default FQDN will break DO where the hostname declaration has a limit of 64 characters.

trinaths commented 3 years ago

created INFRAANO-596 for internal tracking

RavinderReddyF5 commented 2 years ago

@JeffGiroux fixed in v1.1.0