How to Prevent Full Redeployment of Azure Application Gateway with Terraform?

0
24
Asked By CreativeCactus123 On

I'm working with an Azure Application Gateway (WAF_v2) using Terraform and I've encountered an issue. Every time I try to update the configuration by adding new blocks like backend_address_pool, http_listener, probe, or request_routing_rule, Terraform insists on completely redeploying the entire Application Gateway. I thought using for_each within the azurerm_application_gateway resource would help, but it didn't fix the issue. This full redeployment leads to long downtimes for my production workloads. I'm looking for solutions or workarounds to modify specific components without triggering a full redeploy. Has anyone found a way to address this issue with Terraform?

5 Answers

Answered By TerraformTinker On

It sounds like a frustrating situation! Typically, adding or removing blocks shouldn’t trigger a full redeploy. Can you share a bit of your code? It might help to pinpoint the issue. Just so you know, Terraform treats certain attributes as sets, which can complicate things. When you change one item in the set, it thinks the whole list has changed and tries to remove and add them again, hence the redeploy. Keep an eye on the order of your resources and be mindful of those attributes!

Answered By CloudGuru77 On

I'd recommend considering a switch to maps instead of lists. Using lists can lead to those kinds of unwanted changes since Terraform manages them differently. Maps generally provide a more stable way to handle dynamic sets of resources.

Answered By TechieTraveler On

Definitely hit a wall with these configurations. It's frustrating when the design doesn’t support sub-resources properly. It makes using the Application Gateway a bit of a hassle.

Answered By AzureJunkie On

You might be facing a known issue here: [GitHub issue link]. Even though it shouldn't trigger a full redeploy, it can lead to a confusing plan that makes it seem like it will. It's definitely been a headache with the way these resources are currently structured.

Answered By DevWizard99 On

Have you tried using the `ignore_changes` argument? This can help avoid resource replacements if certain attributes change unexpectedly. You can specify which attributes to ignore, that way it won't destroy and recreate the resource every time you make a minor adjustment.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.