{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/9797","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/9797/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/9797/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/9797/events","html_url":"https://github.com/hashicorp/terraform/issues/9797","id":186727522,"number":9797,"title":"AzureRM: terraform cannot re-use imported ResourceGroup","user":{"login":"partamonov","id":12701926,"avatar_url":"https://avatars.githubusercontent.com/u/12701926?v=3","gravatar_id":"","url":"https://api.github.com/users/partamonov","html_url":"https://github.com/partamonov","followers_url":"https://api.github.com/users/partamonov/followers","following_url":"https://api.github.com/users/partamonov/following{/other_user}","gists_url":"https://api.github.com/users/partamonov/gists{/gist_id}","starred_url":"https://api.github.com/users/partamonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/partamonov/subscriptions","organizations_url":"https://api.github.com/users/partamonov/orgs","repos_url":"https://api.github.com/users/partamonov/repos","events_url":"https://api.github.com/users/partamonov/events{/privacy}","received_events_url":"https://api.github.com/users/partamonov/received_events","type":"User","site_admin":false},"labels":[{"id":85946957,"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7","default":true},{"id":300462892,"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/azurerm","name":"provider/azurerm","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-02T07:09:31Z","updated_at":"2016-11-03T10:35:34Z","closed_at":null,"body":"terraform versions: 0.7.7, 0.7.8\r\n\r\nI have resource group, virtual network, subnet created from portal. I imported them with terraform import commands. And using it in code as\r\n```\r\ndata \"terraform_remote_state\" \"core\" {\r\n    backend = \"local\"\r\n    config {\r\n        path = \"${path.cwd}/../core-services/terraform.tfstate\"\r\n    }\r\n}\r\n```\r\n\r\nWhen I'm trying to create VM with Public IP and SG I'm getting the following on terraform apply phase(plan works fine)\r\n\r\n```\r\n* azurerm_storage_account.vm_storage: Error creating Azure Storage Account 'vmtest': storage.AccountsClient#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code=\"InvalidApiVersionParameter\" Message=\"The api-version '2016-01-01' is invalid. The supported versions are '2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.\"\r\n\r\n* azurerm_network_security_group.sg: network.SecurityGroupsClient#CreateOrUpdate: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code=\"Unknown\" Message=\"Unknown service error\"\r\n\r\n* azurerm_public_ip.linux_apps: network.PublicIPAddressesClient#CreateOrUpdate: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code=\"Unknown\" Message=\"Unknown service error\"\r\n```\r\n\r\nDoes anyone have any ideas what's the reason?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/258109019","html_url":"https://github.com/hashicorp/terraform/issues/9797#issuecomment-258109019","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/9797","id":258109019,"user":{"login":"partamonov","id":12701926,"avatar_url":"https://avatars.githubusercontent.com/u/12701926?v=3","gravatar_id":"","url":"https://api.github.com/users/partamonov","html_url":"https://github.com/partamonov","followers_url":"https://api.github.com/users/partamonov/followers","following_url":"https://api.github.com/users/partamonov/following{/other_user}","gists_url":"https://api.github.com/users/partamonov/gists{/gist_id}","starred_url":"https://api.github.com/users/partamonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/partamonov/subscriptions","organizations_url":"https://api.github.com/users/partamonov/orgs","repos_url":"https://api.github.com/users/partamonov/repos","events_url":"https://api.github.com/users/partamonov/events{/privacy}","received_events_url":"https://api.github.com/users/partamonov/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T10:35:34Z","updated_at":"2016-11-03T10:35:34Z","body":"No secrets here, it's almost default example configuration from docs\r\n\r\nIt works if I create everything with terraform. I will get VM with public ip and SG attached, but here will another issue is that if I create subnet and virtual network with terraform I cannot connect to any VMs in that networks\r\n```\r\nresource \"azurerm_public_ip\" \"prd_linux_apps\" {\r\n    name = \"prd_linux_apps\"\r\n    location = \"West Europe\"\r\n    resource_group_name = \"${var.rg}\"\r\n    public_ip_address_allocation = \"static\"\r\n\r\n    tags {\r\n        env = \"prd\"\r\n    }\r\n}\r\n\r\nresource \"azurerm_network_interface\" \"vm\" {\r\n  name                = \"prd_linux_apps_1\"\r\n  location            = \"West Europe\"\r\n  resource_group_name = \"${var.rg}\"\r\n\r\n  ip_configuration {\r\n    name                          = \"prd\"\r\n    subnet_id                     = \"${subnet}\"\r\n    private_ip_address_allocation = \"dynamic\"\r\n    public_ip_address_id          = \"${azurerm_public_ip.prd_linux_apps.id}\"\r\n  }\r\n  network_security_group_id = \"${azurerm_network_security_group.sg.id}\"\r\n}\r\n\r\nresource \"azurerm_network_security_group\" \"sg\" {\r\n    name = \"web-access-sg-default\"\r\n    location = \"West Europe\"\r\n    resource_group_name = \"${var.rg}\"\r\n}\r\n\r\nresource \"azurerm_network_security_rule\" \"ssh\" {\r\n    name = \"SSH\"\r\n    priority = 100\r\n    direction = \"Inbound\"\r\n    access = \"Allow\"\r\n    protocol = \"Tcp\"\r\n    source_port_range = \"22\"\r\n    destination_port_range = \"22\"\r\n    source_address_prefix = \"Internet\"\r\n    destination_address_prefix = \"*\"\r\n    resource_group_name = \"${var.rg}\"\r\n    network_security_group_name = \"${azurerm_network_security_group.sg.name}\"\r\n}\r\n\r\nresource \"azurerm_network_security_rule\" \"http\" {\r\n    name = \"HTTP\"\r\n    priority = 200\r\n    direction = \"Inbound\"\r\n    access = \"Allow\"\r\n    protocol = \"TCP\"\r\n    source_port_range = \"*\"\r\n    destination_port_range = \"80\"\r\n    source_address_prefix = \"*\"\r\n    destination_address_prefix = \"*\"\r\n    resource_group_name = \"${var.rg}\"\r\n    network_security_group_name = \"${azurerm_network_security_group.sg.name}\"\r\n}\r\n\r\nresource \"azurerm_network_security_rule\" \"HTTPS\" {\r\n    name = \"HTTPS\"\r\n    priority = 300\r\n    direction = \"Inbound\"\r\n    access = \"Allow\"\r\n    protocol = \"Tcp\"\r\n    source_port_range = \"*\"\r\n    destination_port_range = \"443\"\r\n    source_address_prefix = \"*\"\r\n    destination_address_prefix = \"*\"\r\n    resource_group_name = \"${var.rg}\"\r\n    network_security_group_name = \"${azurerm_network_security_group.sg.name}\"\r\n}\r\nresource \"azurerm_storage_account\" \"vm_storage\" {\r\n  name                = \"solvinity4vm\"\r\n  resource_group_name = \"${var.rg}\"\r\n  location            = \"West Europe\"\r\n  account_type        = \"Premium_LRS\"\r\n\r\n  tags {\r\n    app = \"solvinity\"\r\n    env = \"prd\"\r\n  }\r\n}\r\n\r\nresource \"azurerm_storage_container\" \"solvinity\" {\r\n  name                  = \"vhds4solvinity\"\r\n  resource_group_name   = \"${var.rg}\"\r\n  storage_account_name  = \"${azurerm_storage_account.vm_storage.name}\"\r\n  container_access_type = \"private\"\r\n}\r\n\r\nresource \"azurerm_virtual_machine\" \"test\" {\r\n    name = \"ws-02\"\r\n    location = \"West Europe\"\r\n    resource_group_name = \"${var.rg}\"\r\n    network_interface_ids = [\"${azurerm_network_interface.vm.id}\"]\r\n    vm_size = \"Standard_DS1_v2\"\r\n    delete_os_disk_on_termination = true\r\n\r\n    storage_image_reference {\r\n        publisher = \"OpenLogic\"\r\n        offer = \"CentOS\"\r\n        sku = \"7.2\"\r\n        version = \"latest\"\r\n    }\r\n\r\n    storage_os_disk {\r\n        name = \"prd-linux-app-static\"\r\n        vhd_uri = \"${azurerm_storage_account.vm_storage.primary_blob_endpoint}${azurerm_storage_container.solvinity.name}/prd-linux-app-static.vhd\"\r\n        caching = \"ReadWrite\"\r\n        create_option = \"FromImage\"\r\n    }\r\n\r\n    os_profile {\r\n        computer_name = \"ws-02\"\r\n        admin_username = \"user\"\r\n        admin_password = \"pass\"\r\n    }\r\n\r\n    os_profile_linux_config {\r\n        disable_password_authentication = false\r\n    }\r\n\r\n    tags {\r\n        app = \"many\"\r\n        env = \"prod\"\r\n        os = \"CentOS\"\r\n        os_version = \"7.2\"\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"partamonov"}}