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

azurerm_virtual_network resource guid attribute #2325

Closed
steve-hawkins opened this issue Nov 15, 2018 · 11 comments
Closed

azurerm_virtual_network resource guid attribute #2325

steve-hawkins opened this issue Nov 15, 2018 · 11 comments

Comments

@steve-hawkins
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

It would be good to have the resourceGuid as an attribute of the Virtual Network resource

This is to support the Azure App Service Virtual Network Integration (that is currently in Preview) which requires the site_config virtual_network_name value to consist of the Virtual Network resourceGuid and the name of the subnet separated by an underscore like follows:-

azurerm_app_service.my_app_service
      site_config.0.virtual_network_name: "911e37e1-7283-452c-bec4-f24c5e7e2aaf_my_subnet"

New or Affected Resource(s)

  • azurerm_virtual_network

Potential Terraform Configuration

data "azurerm_virtual_network" "example" {
  name                = "virtual_network"
  resource_group_name = "${azurerm_resource_group.example.name}"
}

output "virtual_network_guid" {
  value = "${data.azurerm_virtual_network.example.guid}"
}
@tombuildsstuff
Copy link
Contributor

hey @steve-hawkins

Thanks for opening this issue :)

Whilst we've tagged this as a feature request - since other resources in Azure reference each other using a Resource ID rather than a GUID, I've also reached out to the Service Team to see if there's plans to update this to use a Resource ID in the future.

Thanks!

@steve-hawkins
Copy link
Contributor Author

hi @tombuildsstuff thanks for looking into this and I agree, if this could be switched to resource ID it would make a lot more sense

@jlorich
Copy link

jlorich commented Jul 30, 2019

I'd like to note that the App Service Preview VNet integration does not appear to work as intended without this feature. When you look at a properly configured resource the App Service VNet Name needs to be:

"vnetResourceGuid_subnetName", which is not currently available.

@tombuildsstuff
Copy link
Contributor

👋

Jotting some notes down whilst taking a look into this it appears this is available in the SDK as props.ResourceGUID - as such it should be possible to expose this in both the Data Source and the Resource for the Virtual Networks. At the same time it'd be good to add a snippet to the documentation for App Service explaining the intended format for the Virtual Network link here (resourceGuid_subnetName).

@dreasan
Copy link

dreasan commented Sep 20, 2019

At the same time it'd be good to add a snippet to the documentation for App Service explaining the intended format for the Virtual Network link here (resourceGuid_subnetName).

Would be much appreciated. While on it, the Function App resource would also need an update or added example.

@sonata82
Copy link

I don't see the resourceGuid being mapped in data_source_virtual_network.go?

@wtassi
Copy link

wtassi commented Mar 18, 2020

Hello, guys, did you have any outcome on this issue?
Because I'm having the exact same problem. Since microsoft promoted vnet integration it is no longer a preview. Thanks.

@akonrath
Copy link
Contributor

I am interested in working on this issue. I have this working on a local branch for both the vnet data and resource. I'll do further testing, update the docs for the new attribute, and submit a PR.

akonrath added a commit to akonrath/terraform-provider-azurerm that referenced this issue Apr 12, 2020
akonrath added a commit to akonrath/terraform-provider-azurerm that referenced this issue Apr 12, 2020
akonrath added a commit to akonrath/terraform-provider-azurerm that referenced this issue Apr 12, 2020
katbyte pushed a commit that referenced this issue Apr 13, 2020
Addresses #2325

-Add guid (ResourceGUID) attribute to azurerm_virtual_network data source and azurerm_virtual_network resource.
-Update documentation for d/azurerm_virtual_network and r/azurerm_virtual_network to include guid attribute (Also added a trailing period to an existing attribute for consistency)
-Fix acceptance test for azurerm_virtual_network data source (reference to address_space should be singular)
@katbyte katbyte added this to the v2.6.0 milestone Apr 13, 2020
@katbyte katbyte closed this as completed Apr 13, 2020
@kokarn
Copy link

kokarn commented Apr 14, 2020

Great work! Looking forward to a proper vnet integration with Terraform :)

@ghost
Copy link

ghost commented Apr 16, 2020

This has been released in version 2.6.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.6.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 13, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 13, 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

9 participants