-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 FrontDoor : Caching issue - Unexpected resource modifying #4461
Comments
I am having the same issue. |
Also having this issue. I had a look at the GO SDK and the Terraform implementation, and noticed the following in the Go SDK // CacheConfiguration caching settings for a caching-type route. To disable caching, do not provide a
// cacheConfiguration object.
type CacheConfiguration struct {
// QueryParameterStripDirective - Treatment of URL query terms when forming the cache key. Possible values include: 'StripNone', 'StripAll'
QueryParameterStripDirective Query `json:"queryParameterStripDirective,omitempty"`
// DynamicCompression - Whether to use dynamic compression for cached content. Possible values include: 'DynamicCompressionEnabledEnabled', 'DynamicCompressionEnabledDisabled'
DynamicCompression DynamicCompressionEnabled `json:"dynamicCompression,omitempty"`
} While the terraform provider still creates a CacheConfiguration item else {
// Set Defaults
c["cache_query_parameter_strip_directive"] = string(frontdoor.StripNone)
c["cache_use_dynamic_compression"] = false
} The solution might be to have that else branch not set those two values. Not sure. Any ideas? |
@NillsF That is exactly what is happening, I will sneak a fix in for this with my PR to fix the Front Door documentation. |
Looking closer at this I see what the real issue is, I have opened the above PR to fix this issue completly. |
JFYI You can fix this issue by adding the following lifecycle policy for your FrontDoor resource: lifecycle {
ignore_changes = [
routing_rule
]
} Tested on 1.35.0 - 1.36.1 providers. |
I believe I am experiencing the same issue - can we confirm that it was not in fact fully solved in #4618? |
For those who had the same issue, this works for me that won't set cache to Enabled.
|
Ignoring changes on the routing rule isn't working for me. It still enables caching. This is my config: resource "azurerm_frontdoor" "fd" {
name = "${var.prefix}-fd1"
friendly_name = "${var.prefix}-fd1"
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
routing_rule {
name = "routing-rule"
accepted_protocols = ["Http", "Https"]
patterns_to_match = ["/*"]
frontend_endpoints = [
"custom-name"
]
forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = "backend"
}
}
enforce_backend_pools_certificate_name_check = true
backend_pool_load_balancing {
name = "loadbalancing-settings"
}
backend_pool_health_probe {
name = "health-probe"
path = "/_azure/hadr/ping?key=xxxxxx"
protocol = "Https"
interval_in_seconds = 30
}
backend_pool {
name = "backend"
backend {
host_header = var.site_fqdn
address = var.appgw_fqdn
http_port = 80
https_port = 443
}
load_balancing_name = "loadbalancing-settings"
health_probe_name = "health-probe"
}
frontend_endpoint {
name = "custom-name"
host_name = var.site_fqdn
custom_https_provisioning_enabled = true
custom_https_configuration {
certificate_source = "AzureKeyVault"
azure_key_vault_certificate_vault_id = var.certificate_keyvault_id
azure_key_vault_certificate_secret_name = var.certificate_keyvault_secret_name
azure_key_vault_certificate_secret_version = var.certificate_keyvault_secret_version
}
}
lifecycle {
ignore_changes = [
"routing_rule[0].forwarding_configuration[0].cache_query_parameter_strip_directive"
]
}
}
|
I can't get this to work either. Tried variations of ignore_changes but each time Terraform runs it re-enables the caching, which is the only change I make over in Azure. I've included the plan of what Terraform suggests the changes will be, but like I said the only actual change is caching gets turned back on after manually being turned off. At the very least the default should be cache off, as per creating it through the portal. But better yet the ability to control whether it's on or off rather than just it's settings. I'm running azurerm 1.37.0
|
I agree. We should be able to control caching directly. I think it would make sense to have a forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = "backend"
cache_enabled = true
cache_query_parameter_strip_directive = "StripAll"
cache_use_dynamic_compression = true
} |
That's the worst thing. As far as I understand the resource isn't added in a state file yet, that's why the lifecycle rule isn't working. In this case, there 2 crutches ways to solve the issue.
BTW: just try to plan your configuration after that, 50% it can solve the issue, if not: I also want to admit that since FrontDoor exist in state file and caching block ignored, terraform shouldn't enable it even if you change FrontDoor configuration (any other configuration setting) |
When I add the lifecycle {
ignore_changes = [
routing_rule
]
}
|
using the latest 1.39 with terraform 12, but unfortunatly no changes yet. was anyone able to make the ignore_changes work? |
I'm also waiting for the fix so far the workaround was to use the following lifecycle settings, but it's problematic as needs to be removed each time we do actual change to the backend or routing rules and then caching must be removed manually.
|
@devblackops, looking at this closer I am going to implement your suggestion of exposing a
|
Excellent news @WodansSon! Thank you. Would this be in an upcoming minor release then? |
for me it is very important fix as well |
Also looking forward to the ability to disable caching. Thanks! |
This has been released in version 1.42.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.42.0"
}
# ... other configuration ... |
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! |
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_frontdoor
Terraform Configuration Files
- module -- frontdoor
- -- main.tf
Expected Behavior
TERRAFORM SHOULD NOTIFY ABOUT ANY CHANGES
Actual Behavior
Steps to Reproduce
terraform import azurerm_frontdoor.traffic_gateway /subscriptions/...
terraform apply
Check Caching option on frontDoor servire [Azure Portal]
Important Factoids
References
https://docs.microsoft.com/en-us/azure/frontdoor/front-door-caching
The text was updated successfully, but these errors were encountered: