-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Unable to add a private subnet to a vnet with route table #1183
Comments
route tables are not exposed in the API in beta3 yet. |
The application I am working on has a vnet with a public and a private subnet and a route table. I need to bring up clusters and (after users are done with them) destroy them. Each cluster wants its own subnet. So I need to add and remove private subnets from the vnet. I've been trying to figure a workaround for this. If I do this: BUT, the route table isn't used when I finally do: I tried to use I'm hoping someone can help me see how I can hook in here and get the route table in at the right point in the process. |
it looks like this is not really related to the new API -- the way the reference to the RouteTable in the Subnet is auto-generated from the swagger spec is somewhat flawed. SubnetInner#routeTable is expecting a RouteTableInner instance, but it should expect a Subresource since this is only a R/W reference to an existing top level resource, not the resource itself. |
this checkin: be977fa will enable the following short-term workaround to work for assigning route tables to subnets: // network is of type Network and is an existing virtual network
Subnet subnet = network.subnets().get("subnetName");
// routeTableResourceId is the resource ID of an existing route table
subnet.inner().withRouteTable(new SubResource().withId(routeTableResourceId));
network.update().apply(); In a few weeks, route tables will be exposed properly via the new API and this workaround will not be needed. |
route tables are exposed in the upcoming beta4 |
Using azure-jave-sdk 1.0.0-beta3. I have this code:
vnet.update() .withSubnet(clusterSubnetName, subnetCidr) .withTags(tags) .apply();
This fails with the error:
java.lang.IllegalArgumentException: subnets.routeTable.location is required and cannot be null. at com.microsoft.rest.Validator.validate(Validator.java:105) at com.microsoft.azure.management.network.implementation.VirtualNetworksInner.createOrUpdateWithServiceResponseAsync(VirtualNetworksInner.java:472) at com.microsoft.azure.management.network.implementation.VirtualNetworksInner.createOrUpdateAsync(VirtualNetworksInner.java:440) at com.microsoft.azure.management.network.implementation.NetworkImpl.createInner(NetworkImpl.java:202) at com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableParentResourceImpl.createResourceAsync(GroupableParentResourceImpl.java:53) at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.updateResourceAsync(CreatableUpdatableImpl.java:189) at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreateUpdateTask.executeAsync(CreateUpdateTask.java:43) at com.microsoft.azure.TaskGroupBase.executeAsync(TaskGroupBase.java:79) at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.executeTaskGroupAsync(CreatableUpdatableImpl.java:196) at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.applyAsync(CreatableUpdatableImpl.java:157) at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.apply(CreatableUpdatableImpl.java:178)
Looking at the code, it does look like route table is needed, but I cannot find any way to specify it. Is it missing from the beta3 API or am I missing something?
The text was updated successfully, but these errors were encountered: