-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_api_management - support for virtual network integration #5769
azurerm_api_management - support for virtual network integration #5769
Conversation
Whats the status of this? Would love to get this in soon :) |
This will be incredibly helpful for me, looking forward to seeing this put in :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @francescopersico, overall this looks great and i've left a few comments inline that should be addressed. Looks like you forgot to add private_ip_addresses
to the schema
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we validate this is a proper id with azure.ValidateResourceID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
||
func testAccAzureRMApiManagement_virtualNetworkInternal(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
resource "azurerm_resource_group" "test" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need a provider block here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
||
resource "azurerm_virtual_network" "test" { | ||
name = "acctestVNET-%d" | ||
location = "${azurerm_resource_group.test.location}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we switch the test to .12 syntax?
@@ -674,6 +713,8 @@ func resourceArmApiManagementServiceRead(d *schema.ResourceData, meta interface{ | |||
d.Set("management_api_url", props.ManagementAPIURL) | |||
d.Set("scm_url", props.ScmURL) | |||
d.Set("public_ip_addresses", props.PublicIPAddresses) | |||
d.Set("private_ip_addresses", props.PrivateIPAddresses) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property doesn't exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add it to the schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @francescopersico,
thank you for this PR. In addition to the comments i've left and the missing schema for private IP addresses i am noticing the following failure:
FAIL: TestAccAzureRMApiManagement_virtualNetworkInternal (1994.83s)
testing.go:701: Error destroying resource! WARNING: Dangling resources
may exist. The full state and error is shown below.
Error: errors during apply: Error deleting Subnet "acctestSNET-200309190719588572" (Virtual Network "acctestVNET-200309190719588572" / Resource Group "acctestRG-200309190719588572"): network.SubnetsClient#Delete: Failure sending request: StatusCode=400 -- Original Error: Code="InUseSubnetCannotBeDeleted" Message="Subnet acctestSNET-200309190719588572 is in use by /subscriptions/1a6092a6-137e-4025-9a7c-ef77f76f2c02/providers/Microsoft.ApiManagement/service?vnetResourceGuid=f0075bd1-4258-45c9-b336-1ebc09e42a70&subnet=acctestSNET-200309190719588572&api-version=2016-07-07 and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet." Details=[]
@@ -674,6 +713,8 @@ func resourceArmApiManagementServiceRead(d *schema.ResourceData, meta interface{ | |||
d.Set("management_api_url", props.ManagementAPIURL) | |||
d.Set("scm_url", props.ScmURL) | |||
d.Set("public_ip_addresses", props.PublicIPAddresses) | |||
d.Set("private_ip_addresses", props.PrivateIPAddresses) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add it to the schema
@francescopersico unfortunately there's an issue in this version of the API which is fixed in the latest release (but not the intermediate 2019-01-01) release - this is available in the new version of the SDK and as such I'm going to mark this as waiting on that for the moment. Once the SDK been updated we should be able to switch over to this new API version, update the code to match the changes in that version and then update this PR |
@katbyte @tombuildsstuff i have tested and yes there is a problem deleting the resource, the subnet can't be deleted because the APIM deletion process is really long and in background. |
This PR supersedes #6049 as nested go modules and merge conflicts do not spark joy - but fundamentally this: - updates github.com/Azure/azure-sdk-for-go to v40.3.0 - updates github.com/Azure/go-autorest to our fork containing Azure/go-autorest#512 - updates github.com/terraform-providers/terraform-provider-azuread to v0.8.0 - code changes needed for v40.3.0 of the Azure SDK - including opting into the old count 429's as requests which should be retried without adding to the total failure count Enables #5769 Enables #5696
Hi and thanks for your work, I'd like to ask if you're going to release this in next version with resource deletion problem or more likely you would like to way for improvements on Azure side? |
@francescopersico & @cs-marek-ruszczyk, We have updated the SDK so we should be able to update the API version used now |
@katbyte as @tombuildsstuff said the fix is not included in the API v2019-01-01. So i think we must wait for the update of the sdk to v40.6.0 which includes v2019-12-01. |
@francescopersico - API update has been merged! |
Excited to see this coming! Just did a PowerShell script inside Terraform to enable vNet in APIM today heheh thanks for allllll the hard work :) |
Going to update the PR. Thanks. |
c96a325
to
06db1d3
Compare
@katbyte rebase and change requests done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @francescopersico! LGTM and running tests now 🚀
@@ -64,6 +64,14 @@ func resourceArmApiManagementService() *schema.Resource { | |||
}, | |||
}, | |||
|
|||
"private_ip_addresses": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically group computed properties at the bottom of the schema, ie required -> optional -> computes
@francescopersico - i had to add a default to get the tests to pass, but pushed the changes and will merge as soon as travis finishes 🙂 |
This has been released in version 2.7.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.7.0"
}
# ... other configuration ... |
Thank you guys!!! |
This change also includes a new resource variable "private_ip_addresses" which was missed in the documentation. I think it should also be added in? :) website/docs/r/api_management.html.markdown
|
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! |
The PR adds API Management virtual network integration both internal and external.
Fixes #3667