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) #3472

Closed
ghost opened this issue May 19, 2019 · 3 comments
Closed

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

ghost opened this issue May 19, 2019 · 3 comments
Milestone

Comments

@ghost
Copy link

ghost commented May 19, 2019

This issue was originally opened by @DYNSOL as hashicorp/terraform#21358. It was migrated here as a result of the provider split. The original body of the issue is below.


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

@tiwood
Copy link
Contributor

tiwood commented May 27, 2019

This was fixed in 1.28 (#3392)

@tombuildsstuff
Copy link
Contributor

@tiwood thanks for the heads up 👍

@tombuildsstuff tombuildsstuff added this to the v1.28.0 milestone May 28, 2019
@ghost
Copy link
Author

ghost commented Jun 27, 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 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 Jun 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants