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

Azure VNET Peer failing due to VNET State (using modules) #21358

Closed
DYNSOL opened this issue May 19, 2019 · 2 comments
Closed

Azure VNET Peer failing due to VNET State (using modules) #21358

DYNSOL opened this issue May 19, 2019 · 2 comments

Comments

@DYNSOL
Copy link

DYNSOL commented May 19, 2019

Terraform Version

0.11.14

Azure RM Provider Version

1.27

Terraform Configuration Files

module "ProductionvNet" {

    source = "../../modules/Networking/vNet"

    #Module variables
    vNetName                = "${var.ProductionEnvironmentPrefix}-${var.ProductionLocationPrefix}-1"
    RGName                  = "${module.ProductionvNetResourceGroup.Name}"
    vNetLocation            = "${module.ProductionvNetResourceGroup.Location}"
    vNetAddressSpace        = ["######"]
    EnvironmentTag          = "Production"
    vNetDNSServers          = ["####", "####"]  
}

module "ProductionvNetPeering" {

    source = "../../modules/Networking/vNet Peering"

    #Module variables
    vNetPeeringName                 = "name"
    RGName                          = "${module.ProductionvNetResourceGroup.Name}"
    LocalvNetName                   = "${module.ProductionvNet.Name}"
    RemotevNetId                    = "${module.ManagementvNet.Id}"
    IsVirtualNetworkAcccessAllowed  = true
    IsForwardedTrafficAllowed       = false 
    IsGWTransitAllowed              = true
    UseRemoteGW                     = false
}

module "ProductionFrontEndSubnet" {

    source = "../../modules/Networking/Subnet/with RouteTable"

    #Module variables
    SubnetName                  = "subname"
    RGName                      = "${module.ProductionvNetResourceGroup.Name}"
    vNetName                    = "${module.ProductionvNet.Name}"
    Subnetaddressprefix         = "#####"
    EnvironmentTag              = "Production"  

    RouteTableName              = "rtname"
    RTLocation                  = "${module.ProductionvNetResourceGroup.Location}"
    BGPDisabled                 = false   
}

Debug Output

Crash Output

Expected Behavior

I've switched to using modules and since then i've not been able to successfully peer a network. I have a subnet module, vnet module, and a vnet peer module. When i first run terraform apply it fails as with this error:

Resource is not in Succeeded state. Resource is in Updating state and the last operation that updated/is updating the resource is PutSubnetOperation." Details=[]

This is likely because i'm updating the VNET when i'm creating and updating the Subnets. I would usually put a "depends_on" so the resource waits for the subnet changes/updates to finish. However, i don't think this is possible with modules?

Is there any workarounds? Re-running apply works, but i'd prefer the code to deploy first time :) I can include my modules if required.

Actual Behavior

Error: Error applying plan:

2 errors occurred:
        * module.VirtualNetworks.module.ManagementvNetPeering.azurerm_virtual_network_peering.vNetPeering: 1 error occurred:
        * azurerm_virtual_network_peering.vNetPeering: Error Creating/Updating Virtual Network Peering "vn-prd-we-1" (Network "#####" / Resource Group "rg#####"): network.VirtualNetworkPeeringsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="ReferencedResourceNotProvisioned" Message="Cannot proceed with operation because resource /subscriptions/###################################/resourceGroups/###################/providers/Microsoft.Network/virtualNetworks/########### used by resource /subscriptions/######################/resourceGroups/################/providers/Microsoft.Network/virtualNetworks/##############/virtualNetworkPeerings/########### is not in Succeeded state. Resource is in Updating state and the last operation that updated/is updating the resource is PutSubnetOperation." Details=[]

Steps to Reproduce

Additional Context

References

@ghost
Copy link

ghost commented May 19, 2019

This issue has been automatically migrated to hashicorp/terraform-provider-azurerm#3472 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-azurerm#3472.

@ghost
Copy link

ghost commented Jul 25, 2019

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 25, 2019
This issue was closed.
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

2 participants