Hi Team,
My infra in azure and it needs both IPv6 & IPv4 support. I am writing terraform modules to support both addressing in VM & ALB. I find following limitations on both Azure & Terraform.
1. Azure VMSS by default didn't support IPv6.
2. Terraform can't spin up Azure stack (LB, VM, public IP resources) with IPv6.
Using with Azure template & Azure CLI, I can automate VM creation with above requirement. So, I was trying to use "azurerm_template_deployment" in terraform to create stack. It seems that from terraform to arm template, I can only pass string variables but not integers.
ARM Template snippet:
{
"contentVersion": "1.0.0.0",
"parameters": {
"namePrefix": {"type": "string"},
"location": {"type": "string"},
"numberOfNodes": {"type": "int", "defaultValue": 2},
}
}
Terraform resource azurerm_template_deployment parameter snippet:
variable numberOfNodes { default = 0 } # variable initialized with 0, to make sure it is declared as integer
parameters {
namePrefix = "${var.region_name}${var.project}${var.component}${var.environment}"
location = "${var.location}"
numberOfNodes = "${var.numberOfNodes}"
}
Terrform apply failed with:
* azurerm_template_deployment.azurerm_template_deployment: Error creating deployment: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidTemplate" Message="Deployment template validation failed: 'The provided value for the template parameter 'numberOfNodes' at line '1' and column '516' is not valid.'."
How to resolve this error? or do we have anyother better solution by using terraform?
Thanks,