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

Crash after updating Azure RM provider #16329

Closed
frasdav opened this issue Oct 12, 2017 · 3 comments
Closed

Crash after updating Azure RM provider #16329

frasdav opened this issue Oct 12, 2017 · 3 comments

Comments

@frasdav
Copy link

frasdav commented Oct 12, 2017

Terraform Version

Terraform v0.10.7

Terraform Configuration Files

#######################
### RESOURCE GROUPS ###
#######################

#Create the infrastructure resource group
resource "azurerm_resource_group" "infrastructure" {
  name     = "dub-prod-infra-rg"
  location = "North Europe"
  tags {
    environment = "Production"
  }
}

#Create the management resource group
resource "azurerm_resource_group" "management" {
  name     = "dub-prod-man-rg"
  location = "North Europe"
  tags {
    environment = "Production"
  }
}

#Create the NGINX resource group
resource "azurerm_resource_group" "nginx" {
  name     = "dub-prod-ngx-rg"
  location = "North Europe"
  tags {
    environment = "Production"
  }
}

#Create the Couchbase resource group
resource "azurerm_resource_group" "couchbase" {
  name     = "dub-prod-cb-rg"
  location = "North Europe"
  tags {
    environment = "Production"
  }
}

#Create the Elasticsearch resource group
resource "azurerm_resource_group" "elasticsearch" {
  name     = "dub-prod-es-rg"
  location = "North Europe"
  tags {
    environment = "Production"
  }
}

##################
### KEY VAULTS ###
##################

#Create the key vault
resource "azurerm_key_vault" "primary" {
  name                            = "dub-prod-airhead"
  resource_group_name             = "${azurerm_resource_group.infrastructure.name}"
  location                        = "North Europe"
  tenant_id                       = "${var.tenantId}"
  enabled_for_deployment          = true
  enabled_for_template_deployment = true
  sku {
    name = "standard"
  }
  access_policy {
    tenant_id               = "${var.tenantId}"
    object_id               = "318a66da-6e5f-4d17-b775-8e2600f01a79"
    key_permissions         = ["all"]
    secret_permissions      = ["all"]
    certificate_permissions = ["all"]
  }
  access_policy {
    tenant_id               = "${var.tenantId}"
    object_id               = "dd9d7308-5414-4c4e-a11d-de0ac2f220fe"
    key_permissions         = ["all"]
    secret_permissions      = ["all"]
    certificate_permissions = ["all"]
  }
  tags {
    environment = "Production"
  }
}

########################
### STORAGE ACCOUNTS ###
########################

#Create the storage account
resource "azurerm_storage_account" "primary" {
  name                = "dubprodairhead"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  location            = "North Europe"
  account_type        = "Standard_LRS"
  tags {
    environment = "Production"
  }
}

##################
### PUBLIC IPS ###
##################

#Create the load balancer public IP
resource "azurerm_public_ip" "lb" {
  name                         = "dub-prod-lb-ip"
  location                     = "North Europe"
  resource_group_name          = "${azurerm_resource_group.infrastructure.name}"
  public_ip_address_allocation = "static"
  domain_name_label            = "airhead-prod-lb"
}

#Create thegateway public IP
resource "azurerm_public_ip" "gateway" {
  name                         = "dub-prod-gateway-ip"
  location                     = "North Europe"
  resource_group_name          = "${azurerm_resource_group.infrastructure.name}"
  public_ip_address_allocation = "dynamic"
  domain_name_label            = "airhead-prod-gateway"
}

######################
### LOAD BALANCERS ###
######################

#Create the load balancer
resource "azurerm_lb" "primary" {
  name                = "dub-prod-lb"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  frontend_ip_configuration {
    name                 = "primary-ip-config"
    public_ip_address_id = "${azurerm_public_ip.lb.id}"
  }
}

###########################
### LOAD BALANCER RULES ###
###########################

#Create the HTTP load balancer rule
resource "azurerm_lb_rule" "http" {
  resource_group_name            = "${azurerm_resource_group.infrastructure.name}"
  loadbalancer_id                = "${azurerm_lb.primary.id}"
  name                           = "http"
  protocol                       = "Tcp"
  frontend_port                  = 80
  backend_port                   = 80
  enable_floating_ip             = true
  frontend_ip_configuration_name = "primary-ip-config"
  backend_address_pool_id        = "${azurerm_lb_backend_address_pool.nginx.id}"
}

#Create the HTTPS load balancer rule
resource "azurerm_lb_rule" "https" {
  resource_group_name            = "${azurerm_resource_group.infrastructure.name}"
  loadbalancer_id                = "${azurerm_lb.primary.id}"
  name                           = "https"
  protocol                       = "Tcp"
  frontend_port                  = 443
  backend_port                   = 443
  enable_floating_ip             = true
  frontend_ip_configuration_name = "primary-ip-config"
  backend_address_pool_id        = "${azurerm_lb_backend_address_pool.nginx.id}"
}

###########################################
### LOAD BALANCER BACKEND ADDRESS POOLS ###
###########################################

#Create the load balancer backend address pool
resource "azurerm_lb_backend_address_pool" "nginx" {
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  loadbalancer_id     = "${azurerm_lb.primary.id}"
  name                = "ngx"
}

################
### NETWORKS ###
################

#Create the virtual network
resource "azurerm_virtual_network" "primary" {
  name                = "dub-prod-net"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  address_space       = ["172.16.0.0/16"]
  location            = "North Europe"
  dns_servers         = ["8.8.8.8"]
  tags {
    environment = "Production"
  }
}

###############
### SUBNETS ###
###############

#Create the management subnet
resource "azurerm_subnet" "management" {
  name                      = "man"
  resource_group_name       = "${azurerm_resource_group.infrastructure.name}"
  virtual_network_name      = "${azurerm_virtual_network.primary.name}"
  network_security_group_id = "${azurerm_network_security_group.management.id}"
  address_prefix            = "172.16.2.0/24"
}

#Create the NGINX subnet
resource "azurerm_subnet" "nginx" {
  name                      = "ngx"
  resource_group_name       = "${azurerm_resource_group.infrastructure.name}"
  virtual_network_name      = "${azurerm_virtual_network.primary.name}"
  network_security_group_id = "${azurerm_network_security_group.nginx.id}"
  address_prefix            = "172.16.3.0/24"
}

#Create the Couchbase subnet
resource "azurerm_subnet" "couchbase" {
  name                      = "cb"
  resource_group_name       = "${azurerm_resource_group.infrastructure.name}"
  virtual_network_name      = "${azurerm_virtual_network.primary.name}"
  network_security_group_id = "${azurerm_network_security_group.couchbase.id}"
  address_prefix            = "172.16.4.0/24"
}

#Create the Elasticsearch subnet
resource "azurerm_subnet" "elasticsearch" {
  name                      = "es"
  resource_group_name       = "${azurerm_resource_group.infrastructure.name}"
  virtual_network_name      = "${azurerm_virtual_network.primary.name}"
  network_security_group_id = "${azurerm_network_security_group.elasticsearch.id}"
  address_prefix            = "172.16.5.0/24"
}

#Create the web subnet
resource "azurerm_subnet" "web" {
  name                      = "web"
  resource_group_name       = "${azurerm_resource_group.infrastructure.name}"
  virtual_network_name      = "${azurerm_virtual_network.primary.name}"
  network_security_group_id = "${azurerm_network_security_group.web.id}"
  address_prefix            = "172.16.6.0/24"
}

###############################
### NETWORK SECURITY GROUPS ###
###############################

#Create the management network security group
resource "azurerm_network_security_group" "management" {
  name                = "dub-prod-man-nsg"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  security_rule {
    name                       = "AllowAll"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}

#Create the NGINX network security group
resource "azurerm_network_security_group" "nginx" {
  name                = "dub-prod-ngx-nsg"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  security_rule {
    name                       = "AllowAll"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}

#Create the Couchbase network security group
resource "azurerm_network_security_group" "couchbase" {
  name                = "dub-prod-cb-nsg"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  security_rule {
    name                       = "AllowAll"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}

#Create the Elasticsearch network security group
resource "azurerm_network_security_group" "elasticsearch" {
  name                = "dub-prod-es-nsg"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  security_rule {
    name                       = "AllowAll"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}

#Create the web network security group
resource "azurerm_network_security_group" "web" {
  name                = "dub-prod-web-nsg"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.infrastructure.name}"
  security_rule {
    name                       = "AllowAll"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}

##########################
### NETWORK INTERFACES ###
##########################

#Create the management network interface(s)
resource "azurerm_network_interface" "management" {
  count               = "${var.management_vm_instance_count}"
  name                = "dub-prod-man${format("%02d", count.index + 1)}-ni"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.management.name}"
  ip_configuration {
    name                          = "primary-ip-config"
    subnet_id                     = "${azurerm_subnet.management.id}"
    private_ip_address            = "172.16.2.${count.index + 4}"
    private_ip_address_allocation = "static"
  }
  tags {
    environment = "Production"
  }
}

#Create the NGINX network interface(s)
resource "azurerm_network_interface" "nginx" {
  count               = "${var.nginx_vm_instance_count}"
  name                = "dub-prod-ngx${format("%02d", count.index + 1)}-ni"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.nginx.name}"
  ip_configuration {
    name                                    = "primary-ip-config"
    subnet_id                               = "${azurerm_subnet.nginx.id}"
    private_ip_address                      = "172.16.3.${count.index + 4}"
    private_ip_address_allocation           = "static"
    load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.nginx.id}"]
  }
  tags {
    environment = "Production"
  }
}

#Create the Couchbase network interface(s)
resource "azurerm_network_interface" "couchbase" {
  count               = "${var.couchbase_vm_instance_count}"
  name                = "dub-prod-cb${format("%02d", count.index + 1)}-ni"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.couchbase.name}"
  ip_configuration {
    name                          = "primary-ip-config"
    subnet_id                     = "${azurerm_subnet.couchbase.id}"
    private_ip_address            = "172.16.4.${count.index + 4}"
    private_ip_address_allocation = "static"
  }
  tags {
    environment = "Production"
  }
}

#Create the Elasticsearch network interface(s)
resource "azurerm_network_interface" "elasticsearch" {
  count               = "${var.elasticsearch_vm_instance_count}"
  name                = "dub-prod-es${format("%02d", count.index + 1)}-ni"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.elasticsearch.name}"
  ip_configuration {
    name                          = "primary-ip-config"
    subnet_id                     = "${azurerm_subnet.elasticsearch.id}"
    private_ip_address            = "172.16.5.${count.index + 4}"
    private_ip_address_allocation = "static"
  }
  tags {
    environment = "Production"
  }
}

#########################
### AVAILABILITY SETS ###
#########################

#Create the management availability set
resource "azurerm_availability_set" "management" {
  name                = "dub-prod-man-as"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.management.name}"
  managed             = true
  tags {
    environment = "Production"
  }
}

#Create the NGINX availability set
resource "azurerm_availability_set" "nginx" {
  name                = "dub-prod-ngx-as"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.nginx.name}"
  managed             = true
  tags {
    environment = "Production"
  }
}

#Create the Couchbase availability set
resource "azurerm_availability_set" "couchbase" {
  name                = "dub-prod-cb-as"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.couchbase.name}"
  managed             = true
  tags {
    environment = "Production"
  }
}

#Create the Elasticsearch availability set
resource "azurerm_availability_set" "elasticsearch" {
  name                = "dub-prod-es-as"
  location            = "North Europe"
  resource_group_name = "${azurerm_resource_group.elasticsearch.name}"
  managed             = true
  tags {
    environment = "Production"
  }
}

########################
### VIRTUAL MACHINES ###
########################

#Create the management virtual machine(s)
resource "azurerm_virtual_machine" "management" {
  count                 = "${var.management_vm_instance_count}"
  name                  = "dub-prod-man${format("%02d", count.index + 1)}-vm"
  location              = "North Europe"
  availability_set_id   = "${azurerm_availability_set.management.id}"
  resource_group_name   = "${azurerm_resource_group.management.name}"
  network_interface_ids = ["${element(azurerm_network_interface.management.*.id, count.index)}"]
  vm_size               = "${var.management_vm_instance_size}"
  boot_diagnostics {
    enabled = true
    storage_uri = "${azurerm_storage_account.primary.primary_blob_endpoint}"
  }
  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }
  storage_os_disk {
    name              = "dub-prod-man${format("%02d", count.index + 1)}-os-disk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
  os_profile {
    computer_name  = "man${format("%02d", count.index + 1)}"
    admin_username = "airhead"
  }
  os_profile_linux_config {
    disable_password_authentication = true
    ssh_keys                        = [
        {
            path     = "/home/airhead/.ssh/authorized_keys"
            key_data = "${var.airhead_public_key}"
        }
    ]
  }
  tags {
    environment = "Production"
  }
}

#Create the NGINX virtual machine(s)
resource "azurerm_virtual_machine" "nginx" {
  count                 = "${var.nginx_vm_instance_count}"
  name                  = "dub-prod-ngx${format("%02d", count.index + 1)}-vm"
  location              = "North Europe"
  availability_set_id   = "${azurerm_availability_set.nginx.id}"
  resource_group_name   = "${azurerm_resource_group.nginx.name}"
  network_interface_ids = ["${element(azurerm_network_interface.nginx.*.id, count.index)}"]
  vm_size               = "${var.nginx_vm_instance_size}"
  boot_diagnostics {
    enabled = true
    storage_uri = "${azurerm_storage_account.primary.primary_blob_endpoint}"
  }
  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }
  storage_os_disk {
    name              = "dub-prod-ngx${format("%02d", count.index + 1)}-os-disk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
  os_profile {
    computer_name  = "ngx${format("%02d", count.index + 1)}"
    admin_username = "airhead"
  }
  os_profile_linux_config {
    disable_password_authentication = true
    ssh_keys                        = [
        {
            path     = "/home/airhead/.ssh/authorized_keys"
            key_data = "${var.airhead_public_key}"
        }
    ]
  }
  tags {
    environment = "Production"
  }
}

#Create the Couchbase virtual machine(s)
resource "azurerm_virtual_machine" "couchbase" {
  count                 = "${var.couchbase_vm_instance_count}"
  name                  = "dub-prod-cb${format("%02d", count.index + 1)}-vm"
  location              = "North Europe"
  availability_set_id   = "${azurerm_availability_set.couchbase.id}"
  resource_group_name   = "${azurerm_resource_group.couchbase.name}"
  network_interface_ids = ["${element(azurerm_network_interface.couchbase.*.id, count.index)}"]
  vm_size               = "${var.couchbase_vm_instance_size}"
  boot_diagnostics {
    enabled = true
    storage_uri = "${azurerm_storage_account.primary.primary_blob_endpoint}"
  }
  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "14.04.5-LTS"
    version   = "latest"
  }
  storage_os_disk {
    name              = "dub-prod-cb${format("%02d", count.index + 1)}-os-disk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
  storage_data_disk {
    name              = "dub-prod-cb${format("%02d", count.index + 1)}-data-disk"
    managed_disk_type = "Standard_LRS"
    create_option     = "Empty"
    lun               = 0
    disk_size_gb      = "32"
  }
  os_profile {
    computer_name  = "cb${format("%02d", count.index + 1)}"
    admin_username = "airhead"
  }
  os_profile_linux_config {
    disable_password_authentication = true
    ssh_keys                        = [
        {
            path     = "/home/airhead/.ssh/authorized_keys"
            key_data = "${var.airhead_public_key}"
        }
    ]
  }
  tags {
    environment = "Production"
  }
}

#Create the Elasticsearch virtual machine(s)
resource "azurerm_virtual_machine" "elasticsearch" {
  count                 = "${var.elasticsearch_vm_instance_count}"
  name                  = "dub-prod-es${format("%02d", count.index + 1)}-vm"
  location              = "North Europe"
  availability_set_id   = "${azurerm_availability_set.elasticsearch.id}"
  resource_group_name   = "${azurerm_resource_group.elasticsearch.name}"
  network_interface_ids = ["${element(azurerm_network_interface.elasticsearch.*.id, count.index)}"]
  vm_size               = "${var.elasticsearch_vm_instance_size}"
  boot_diagnostics {
    enabled = true
    storage_uri = "${azurerm_storage_account.primary.primary_blob_endpoint}"
  }
  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }
  storage_os_disk {
    name              = "dub-prod-es${format("%02d", count.index + 1)}-os-disk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
  storage_data_disk {
    name              = "dub-prod-es${format("%02d", count.index + 1)}-data-disk"
    managed_disk_type = "Standard_LRS"
    create_option     = "Empty"
    lun               = 0
    disk_size_gb      = "32"
  }
  os_profile {
    computer_name  = "es${format("%02d", count.index + 1)}"
    admin_username = "airhead"
  }
  os_profile_linux_config {
    disable_password_authentication = true
    ssh_keys                        = [
        {
            path     = "/home/airhead/.ssh/authorized_keys"
            key_data = "${var.airhead_public_key}"
        }
    ]
  }
  tags {
    environment = "Production"
  }
}

Crash Output

https://1drv.ms/u/s!Argl0mjth4UG7gE8kie2ELQM3CDh

Steps to Reproduce

  1. terraform init
  2. terraform plan

Important Factoids

This was working fine before I updated the Azure RM provider

@frasdav
Copy link
Author

frasdav commented Oct 12, 2017

This was with Azure provider 0.2.2. Rolled back to 0.2.1, same issue. Rolled back to 0.1.7, all good.

@hashibot
Copy link
Contributor

This issue has been automatically migrated to hashicorp/terraform-provider-azurerm#427 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Apr 7, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

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

No branches or pull requests

3 participants