{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/13100","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/13100/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/13100/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/13100/events","html_url":"https://github.com/hashicorp/terraform/issues/13100","id":217305954,"number":13100,"title":"Unable to scale up Azure Container Service Agent pool","user":{"login":"theintz","id":800124,"avatar_url":"https://avatars3.githubusercontent.com/u/800124?v=3","gravatar_id":"","url":"https://api.github.com/users/theintz","html_url":"https://github.com/theintz","followers_url":"https://api.github.com/users/theintz/followers","following_url":"https://api.github.com/users/theintz/following{/other_user}","gists_url":"https://api.github.com/users/theintz/gists{/gist_id}","starred_url":"https://api.github.com/users/theintz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theintz/subscriptions","organizations_url":"https://api.github.com/users/theintz/orgs","repos_url":"https://api.github.com/users/theintz/repos","events_url":"https://api.github.com/users/theintz/events{/privacy}","received_events_url":"https://api.github.com/users/theintz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-27T16:42:28Z","updated_at":"2017-03-27T16:52:53Z","closed_at":null,"body":"I am trying to use TF to manage my Azure resources, most importantly the Container Service using Kubernetes. Here is the relevant excerpt from the config file:\r\n```hcl\r\nresource \"azurerm_container_service\" \"dev-cs\" {\r\n  name                   = \"devcontainers\"\r\n  location               = \"${azurerm_resource_group.dev-rg-containers.location}\"\r\n  resource_group_name    = \"${azurerm_resource_group.dev-rg-containers.name}\"\r\n  orchestration_platform = \"Kubernetes\"\r\n\r\n  master_profile {\r\n    count      = 1\r\n    dns_prefix = \"kube-master\"\r\n  }\r\n\r\n  linux_profile {\r\n    admin_username = \"gesund\"\r\n\r\n    ssh_key {\r\n      key_data = \"${file(\"ssh-keys/key.pub\")}\"\r\n    }\r\n  }\r\n\r\n  agent_pool_profile {\r\n    name       = \"dev-agent\"\r\n    count      = 2\r\n    dns_prefix = \"kube-agent\"\r\n    vm_size    = \"Standard_A0\"\r\n  }\r\n\r\n  service_principal {\r\n    client_id     = \"${var.dev-cs-client-id}\"\r\n    client_secret = \"${var.dev-cs-client-secret}\"\r\n  }\r\n\r\n  diagnostics_profile {\r\n    enabled = false\r\n  }\r\n}\r\n```\r\nThis works well and creates an instance of the ACS with two agent VMs running. Now I am trying to scale up the agent pool to 4 instances by changing the `count` to 4. `terraform plan` now wants to destroy the entire ACS:\r\n```\r\n➜  autodeploy-dev git:(master) ✗ terraform plan\r\nRefreshing Terraform state in-memory prior to plan...\r\nThe refreshed state will be used to calculate this plan, but will not be\r\npersisted to local or remote state storage.\r\n[...]\r\n-/+ azurerm_container_service.dev-cs\r\n    agent_pool_profile.#:                                 \"1\" => \"1\"\r\n    agent_pool_profile.1269455163.count:                  \"\" => \"3\"\r\n    agent_pool_profile.1269455163.dns_prefix:             \"\" => \"kube-agent\" (forces new resource)\r\n    agent_pool_profile.1269455163.fqdn:                   \"\" => \"<computed>\"\r\n    agent_pool_profile.1269455163.name:                   \"\" => \"dev-agent\" (forces new resource)\r\n    agent_pool_profile.1269455163.vm_size:                \"\" => \"Standard_A0\"\r\n    agent_pool_profile.584274526.count:                   \"2\" => \"0\"\r\n    agent_pool_profile.584274526.dns_prefix:              \"kube-agent\" => \"\" (forces new resource)\r\n    agent_pool_profile.584274526.name:                    \"dev-agent\" => \"\" (forces new resource)\r\n    agent_pool_profile.584274526.vm_size:                 \"Standard_A0\" => \"\"\r\n    diagnostics_profile.#:                                \"1\" => \"1\"\r\n    diagnostics_profile.734881840.enabled:                \"false\" => \"false\"\r\n    diagnostics_profile.734881840.storage_uri:            \"\" => \"<computed>\"\r\n    linux_profile.#:                                      \"1\" => \"1\"\r\n    linux_profile.1875963313.admin_username:              \"gesund\" => \"gesund\"\r\n    linux_profile.1875963313.ssh_key.#:                   \"1\" => \"1\"\r\n    linux_profile.1875963313.ssh_key.3348459114.key_data: \"ssh-rsa [...]\" => \"ssh-rsa [...]\"\r\n    location:                                             \"westeurope\" => \"westeurope\"\r\n    master_profile.#:                                     \"1\" => \"1\"\r\n    master_profile.1785126391.count:                      \"1\" => \"1\"\r\n    master_profile.1785126391.dns_prefix:                 \"kube-master\" => \"kube-master\"\r\n    master_profile.1785126391.fqdn:                       \"\" => \"<computed>\"\r\n    name:                                                 \"devcontainers\" => \"devcontainers\"\r\n    orchestration_platform:                               \"Kubernetes\" => \"Kubernetes\"\r\n    service_principal.#:                                  \"1\" => \"1\"\r\n    service_principal.3038453274.client_id:               \"[...]\" => \"[...]\"\r\n    service_principal.3038453274.client_secret:           \"<sensitive>\" => \"<sensitive>\" (attribute changed)\r\n    tags.%:                                               \"0\" => \"<computed>\"\r\n\r\n\r\nPlan: 1 to add, 0 to change, 1 to destroy.\r\n```\r\nAnd running `terraform apply` just errors out:\r\n```\r\n➜  autodeploy-dev git:(master) ✗ terraform apply\r\nazurerm_container_service.dev-cs: Destroying... (ID: /subscrip...ntainers)\r\nazurerm_container_service.dev-cs: Destruction complete\r\nazurerm_container_service.dev-cs: Creating...\r\n[...]\r\nError applying plan:\r\n\r\n1 error(s) occurred:\r\n\r\n* azurerm_container_service.dev-cs: containerservice.ContainerServicesClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code=\"DnsRecordInUse\" Message=\"Provisioning of resource(s) for container service 'devcontainers' in resource group 'dev-containers' failed with errors: Resource type: Microsoft.Network/publicIPAddresses, name: k8s-master-ip-kube-master-2A2974EA, id: /subscriptions/[...]/resourceGroups/dev-containers/providers/Microsoft.Network/publicIPAddresses/k8s-master-ip-kube-master-2A2974EA, StatusCode: BadRequest, StatusMessage: \\\\n {\\r\\n  \\\"error\\\": {\\r\\n    \\\"code\\\": \\\"DnsRecordInUse\\\",\\r\\n    \\\"message\\\": \\\"DNS record kube-master.westeurope.cloudapp.azure.com is already used by another public IP.\\\",\\r\\n    \\\"details\\\": []\\r\\n  }\\r\\n}\\r\\n\"\r\n```\r\nFurther TF has now forgotten that the ACS instance is still alive (as verified in the Azure portal) and wants to entirely recreate it when I run `terraform apply` again.\r\n\r\n### Terraform Version\r\n0.9.1\r\n\r\n### Affected Resource(s)\r\n- Azure Container Services\r\n\r\n### Terraform Configuration Files\r\nsee above\r\n\r\n### Debug Output\r\nsee above\r\n\r\n### Expected Behavior\r\nAgent pool VM instances scaled up from 2 to 4.\r\n\r\n### Actual Behavior\r\nTF crashes and \"forgets\" about ACS instance altogether.\r\n\r\n### Steps to Reproduce\r\nsee above\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/289514409","html_url":"https://github.com/hashicorp/terraform/issues/13100#issuecomment-289514409","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/13100","id":289514409,"user":{"login":"theintz","id":800124,"avatar_url":"https://avatars3.githubusercontent.com/u/800124?v=3","gravatar_id":"","url":"https://api.github.com/users/theintz","html_url":"https://github.com/theintz","followers_url":"https://api.github.com/users/theintz/followers","following_url":"https://api.github.com/users/theintz/following{/other_user}","gists_url":"https://api.github.com/users/theintz/gists{/gist_id}","starred_url":"https://api.github.com/users/theintz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theintz/subscriptions","organizations_url":"https://api.github.com/users/theintz/orgs","repos_url":"https://api.github.com/users/theintz/repos","events_url":"https://api.github.com/users/theintz/events{/privacy}","received_events_url":"https://api.github.com/users/theintz/received_events","type":"User","site_admin":false},"created_at":"2017-03-27T16:52:53Z","updated_at":"2017-03-27T16:52:53Z","body":"It appears to be quite simple to achieve this using the remote CLI tool: https://docs.microsoft.com/en-us/azure/container-service/container-service-scale"}}
{"actor":{"display_login":"theintz"}}