Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM Scale Set fails if computer_name_prefix is greater than 9 characters #871

Closed
PleaseStopAsking opened this issue Feb 21, 2018 · 3 comments · Fixed by #889
Closed

VM Scale Set fails if computer_name_prefix is greater than 9 characters #871

PleaseStopAsking opened this issue Feb 21, 2018 · 3 comments · Fixed by #889

Comments

@PleaseStopAsking
Copy link

Terraform Version

Terraform v0.11.3

  • provider.azurerm v1.1.2
  • provider.random v1.1.0

Affected Resource(s)

  • azurerm_virtual_machine_scale_set

Terraform Configuration Files

variable "customerProject" {
    default = "apphst"
}

variable "environment" {
    default = "stg"
}

variable "machineAcronyms" {
    default = {
	Server = "ags"
	Jumpbox	= "jmp"
    }
}

resource "azurerm_virtual_machine_scale_set" "ServerScaleSet" {
    name = "${var.customerProject}${var.environment}${var.machineAcronyms["Server"]}"
    location = "${var.location}"
    resource_group_name = "${azurerm_resource_group.rg.name}"
    upgrade_policy_mode	= "Manual"

    sku {
        name = "${var.Server_Specs["ServerType"]}"
    	tier = "Standard"
    	capacity = 1
    }

    storage_profile_image_reference {
        publisher = "${var.Server_Specs["Image_Publisher"]}"
        offer = "${var.Server_Specs["Image_Offer"]}"
	sku = "${var.Server_Specs["Image_sku"]}"
	version = "${var.Server_Specs["Image_Version"]}"
    }

    plan {
	name = "${var.Server_Specs["Plan_Name"]}"
	publisher = "${var.Server_Specs["Plan_Publisher"]}"
	product = "${var.Server_Specs["Plan_Product"]}"
    }

    storage_profile_os_disk {
	name = ""
	managed_disk_type = "${var.Server_Specs["OS_Disk_Type"]}"
	caching = "${var.Server_Specs["OS_Disk_Caching"]}"
	create_option = "${var.Server_Specs["OS_Disk_Create_option"]}"
    }

    storage_profile_data_disk {
	managed_disk_type = "${var.Server_Specs["Data_Disk_Type"]}"
	caching = "${var.Server_Specs["Data_Disk_Caching"]}"
	create_option = "${var.Server_Specs["Data_Disk_Create_Option"]}"
	disk_size_gb = "${var.Server_Specs["Data_Disk_Disk_Size"]}"
	lun = "${var.Server_Specs["Data_Disk_Disk_Lun"]}"
    }

    os_profile {
	computer_name_prefix = "${var.customerProject}${var.environment}${var.machineAcronyms["Server"]}"
	admin_username = "${var.EmcsAdminCredentials["Username"]}"
	admin_password = "${var.EmcsAdminCredentials["Password"]}"
    }

    os_profile_windows_config {
	provision_vm_agent  = "true"
    }

    network_profile {
	name = "${var.customerProject}${var.environment}${var.machineAcronyms["Server"]}"
	primary = true

	ip_configuration {
	    name = "${var.customerProject}${var.environment}${var.machineAcronyms["Server"]}"
	    subnet_id   = "${azurerm_subnet.PrivateSubnet.id}"
	}
    }
}

Expected Behavior

The template should succeed.

Actual Behavior

The template fails with the following message.

azurerm_virtual_machine_scale_set.ServerScaleSet: 1 error(s) occurred:

* azurerm_virtual_machine_scale_set.ServerScaleSet: compute.VirtualMachineScaleSetsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidParameter" Message="Windows computer name prefix cannot be more than 9 characters long, be entirely numeric, or contain the following characters: ` ~ ! @ # $
% ^ & * ( ) = + _ [ ] { } \\ | ; : . ' \" , < > / ?. Provided computer name prefix: apphststgags."

Important Factoids

The online docs indicate that the length should be between 1-15 characters.
https://www.terraform.io/docs/providers/azurerm/r/virtual_machine_scale_set.html#computer_name_prefix

@PleaseStopAsking
Copy link
Author

Hi @tombuildsstuff

Is this an issue with the documentation not correctly showing the number of characters or an issue with terraform not allowing 15 characters?

Thanks,

@katbyte katbyte self-assigned this Feb 22, 2018
@katbyte
Copy link
Collaborator

katbyte commented Feb 23, 2018

Hello @PleaseStopAsking,

This is an issue with the documentation. Windows hosts are limited to a 9 character prefix while linux ones can go up to 58 characters.

Thank you for pointing it out! I will go and correct it today.

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants