{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/1730","repository_url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/1730/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/1730/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/1730/events","html_url":"https://github.com/terraform-providers/terraform-provider-azurerm/issues/1730","id":348112549,"node_id":"MDU6SXNzdWUzNDgxMTI1NDk=","number":1730,"title":"Referencing resource_group_name by string results in `ResourceGroupNotFound`","user":{"login":"errygg","id":1319170,"node_id":"MDQ6VXNlcjEzMTkxNzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1319170?v=4","gravatar_id":"","url":"https://api.github.com/users/errygg","html_url":"https://github.com/errygg","followers_url":"https://api.github.com/users/errygg/followers","following_url":"https://api.github.com/users/errygg/following{/other_user}","gists_url":"https://api.github.com/users/errygg/gists{/gist_id}","starred_url":"https://api.github.com/users/errygg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/errygg/subscriptions","organizations_url":"https://api.github.com/users/errygg/orgs","repos_url":"https://api.github.com/users/errygg/repos","events_url":"https://api.github.com/users/errygg/events{/privacy}","received_events_url":"https://api.github.com/users/errygg/received_events","type":"User","site_admin":false},"labels":[{"id":620326290,"node_id":"MDU6TGFiZWw2MjAzMjYyOTA=","url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-06T23:15:27Z","updated_at":"2018-08-07T19:27:30Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nPlease note the following potential times when an issue might be in Terraform core:\r\n\r\n* [Configuration Language](https://www.terraform.io/docs/configuration/index.html) or resource ordering issues\r\n* [State](https://www.terraform.io/docs/state/index.html) and [State Backend](https://www.terraform.io/docs/backends/index.html) issues\r\n* [Provisioner](https://www.terraform.io/docs/provisioners/index.html) issues\r\n* [Registry](https://registry.terraform.io/) issues\r\n* Spans resources across multiple providers\r\n\r\nIf you are running into one of these scenarios, we recommend opening an issue in the [Terraform core repository](https://github.com/hashicorp/terraform/) instead.\r\n--->\r\n\r\n<!--- Please keep this note for the community --->\r\n\r\n### Community Note\r\n\r\n* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request\r\n* Please do not leave \"+1\" or \"me too\" comments, they generate extra noise for issue followers and do not help prioritize the request\r\n* If you are interested in working on this issue or have submitted a pull request, please leave a comment\r\n\r\n<!--- Thank you for keeping this note for the community --->\r\n\r\n### Terraform Version\r\n```\r\nTerraform v0.11.7\r\n+ provider.azurerm v1.12.0\r\n```\r\n\r\n<!--- Please run `terraform -v` to show the Terraform core version and provider version(s). If you are not running the latest version of Terraform or the provider, please upgrade because your issue may have already been fixed. [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#provider-versions). --->\r\n\r\n### Affected Resource(s)\r\n\r\n<!--- Please list the affected resources and data sources. --->\r\n\r\n* `azurerm_resource_group`\r\n* `azurerm_virtual_network`\r\n\r\n### Terraform Configuration Files\r\n\r\n<!--- Information about code formatting: https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code --->\r\n\r\n```hcl\r\nresource \"azurerm_resource_group\" \"my_rg\" {\r\n  name = \"my_rg\"\r\n  location = \"West US\"\r\n}\r\n\r\nresource \"azurerm_virtual_network\" \"my_vnet\" {\r\n  name = \"my_vnet\"\r\n  address_space = \"10.0.0.0/16\"\r\n  location = \"West US\"\r\n  resource_group_name = \"my_rg\"\r\n}\r\n```\r\n\r\n### Debug Output\r\n\r\n<!---\r\nPlease provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.\r\n\r\nTo obtain the debug output, see the [Terraform documentation on debugging](https://www.terraform.io/docs/internals/debugging.html).\r\n--->\r\n\r\nhttps://gist.github.com/errygg/f5ae7758873ab01a41fe62424c20d876#file-terraform-azurerm-resource-group-issue\r\n\r\n### Expected Behavior\r\n\r\nThe provider should recognize string name references to resource groups and create the virtual network without issue.\r\n\r\n### Actual Behavior\r\n\r\nTerraform errors because the reference to the resource group can't be found.\r\n\r\n### Steps to Reproduce\r\n\r\n<!--- Please list the steps required to reproduce the issue. --->\r\n\r\n1. `terraform apply`\r\n\r\n### Important Factoids\r\n\r\n<!--- Are there anything atypical about your accounts that we should know? For example: Running in a Azure China/Germany/Government? --->\r\n\r\nThe reference works with the following resource reference:\r\n\r\n```hcl\r\nresource \"azurerm_resource_group\" \"my_rg\" {\r\n  name     = \"my_rg\"\r\n  location = \"West US\"\r\n}\r\n\r\nresource \"azurerm_virtual_network\" \"my_vnet\" {\r\n  name                             = \"my_vnet\"\r\n  address_space             = \"10.0.0.0/16\"\r\n  location                         = \"West US\"\r\n  resource_group_name = \"${azurerm_resource_group.my_rg.name}\"\r\n}\r\n```\r\n\r\nAdditionally, when running `terraform apply` a second time, the virtual network will get created. Seems as though there is a timing issue?\r\n\r\n### References\r\n\r\n<!---\r\nInformation about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests\r\n\r\nAre there any other GitHub issues (open or closed) or pull requests that should be linked here? Such as vendor documentation?\r\n--->\r\n\r\n* #532 \r\n"},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/comments/411173429","html_url":"https://github.com/terraform-providers/terraform-provider-azurerm/issues/1730#issuecomment-411173429","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-azurerm/issues/1730","id":411173429,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTE3MzQyOQ==","user":{"login":"katbyte","id":1638467,"node_id":"MDQ6VXNlcjE2Mzg0Njc=","avatar_url":"https://avatars2.githubusercontent.com/u/1638467?v=4","gravatar_id":"","url":"https://api.github.com/users/katbyte","html_url":"https://github.com/katbyte","followers_url":"https://api.github.com/users/katbyte/followers","following_url":"https://api.github.com/users/katbyte/following{/other_user}","gists_url":"https://api.github.com/users/katbyte/gists{/gist_id}","starred_url":"https://api.github.com/users/katbyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katbyte/subscriptions","organizations_url":"https://api.github.com/users/katbyte/orgs","repos_url":"https://api.github.com/users/katbyte/repos","events_url":"https://api.github.com/users/katbyte/events{/privacy}","received_events_url":"https://api.github.com/users/katbyte/received_events","type":"User","site_admin":false},"created_at":"2018-08-07T19:27:30Z","updated_at":"2018-08-07T19:27:30Z","author_association":"CONTRIBUTOR","body":"Hi @errygg,\r\n\r\nThis definitely appears to be an ordering issue. Terraform is not aware of the dependancy between the virtual network and the resource group until you let it know with `depends_on` or either reference it: `\"${azurerm_resource_group.my_rg.name}\"`.\r\n\r\nThe provider will not recognize a simple string as the name of another resource.\r\n\r\nI hope this helps."}}
{"actor":{"display_login":"katbyte"}}