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

aurerm_dev_test_virtual_network: generate subnet IDs in the correct format #3717

Merged
merged 2 commits into from
Jul 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions azurerm/resource_arm_dev_test_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func resourceArmDevTestVirtualNetworkCreate(d *schema.ResourceData, meta interfa

subscriptionId := meta.(*ArmClient).subscriptionId
subnetsRaw := d.Get("subnet").([]interface{})
subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, resourceGroup, labName, name)
subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, resourceGroup, name)

parameters := dtl.VirtualNetwork{
Tags: expandTags(tags),
Expand Down Expand Up @@ -208,7 +208,7 @@ func resourceArmDevTestVirtualNetworkUpdate(d *schema.ResourceData, meta interfa

subscriptionId := meta.(*ArmClient).subscriptionId
subnetsRaw := d.Get("subnet").([]interface{})
subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, resourceGroup, labName, name)
subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, resourceGroup, name)

parameters := dtl.VirtualNetwork{
Tags: expandTags(tags),
Expand Down Expand Up @@ -282,12 +282,12 @@ func validateDevTestVirtualNetworkName() schema.SchemaValidateFunc {
"Virtual Network Name can only include alphanumeric characters, underscores, hyphens.")
}

func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, resourceGroupName, labName, virtualNetworkName string) *[]dtl.SubnetOverride {
func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, resourceGroupName, virtualNetworkName string) *[]dtl.SubnetOverride {
results := make([]dtl.SubnetOverride, 0)
// default found from the Portal
name := fmt.Sprintf("%sSubnet", virtualNetworkName)
idFmt := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/virtualnetworks/%s/subnets/%s"
subnetId := fmt.Sprintf(idFmt, subscriptionId, resourceGroupName, labName, virtualNetworkName, name)
idFmt := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s"
subnetId := fmt.Sprintf(idFmt, subscriptionId, resourceGroupName, virtualNetworkName, name)
if len(input) == 0 {
result := dtl.SubnetOverride{
ResourceID: utils.String(subnetId),
Expand Down