-
Notifications
You must be signed in to change notification settings - Fork 11
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
Idempotency broken when creating volterra_http_loadbalancer with simple_route and origin_pool due to : kind = (known after apply) #277
Comments
Second this @slavekjurkowski2! We see Terraform attempting to unset the In all cases, we see We have (for now) resorted to extracting changes from a Either way, looking into the diff, we're seeing that our state file records Diving into the state file, and comparing against the Volterra API, we see the following (though I'm sure there'd be a few more in there too):
It's very odd, because the fields in all three cases are set as What it seems is happening is that in the
Are not updating the Because the state file has func FlattenObjectRefTypeSet(x *ves_io_schema_views.ObjectRefType) []interface{} {
res := make([]interface{}, 0)
if x != nil {
val := map[string]interface{}{
"name": x.GetName(),
"namespace": x.GetNamespace(),
"tenant": x.GetTenant(),
}
res = append(res, val)
}
return res
} While all the resource schema definitions include the TL;DR: since drift detection came in, it seems that the provider has never set the The provider should either be updated to set the (Note: in our case, this is in the process of preparing a migration from |
The real problem here, to simplify things: In the case of origin pools, for example
When drift detection runs, the |
Not that I have any way to build this module myself, but adding |
@jcspencer Thank you for your detailed analysis. We will address this in the upcoming release. |
I believe idempotency is broken in the case where volterra_http_loadbalancer with simple_route and origin_pool is provisioned with terraform due to : kind = (known after apply)
Terraform v1.9.5
on linux_arm64
########Module Code:
locals {
use_service_policies_from_namespace = length(var.active_service_policies) == 0 ? true : false
}
resource "volterra_http_loadbalancer" "lb-https-tf" {
depends_on = [var.depends_on_origin_pool]
name = "${var.name_prefix}-lb-https-${var.name_suffix}"
namespace = var.namespace
domains = var.https_config["https"].domains
default_sensitive_data_policy = var.default_sensitive_data_policy
disable_api_definition = var.disable_api_definition
disable_api_discovery = var.disable_api_discovery
disable_malicious_user_detection = var.disable_malicious_user_detection
disable_threat_mesh = var.disable_threat_mesh
disable_trust_client_ip_headers = var.disable_trust_client_ip_headers
l7_ddos_action_default = var.l7_ddos_action_default
advertise_on_public_default_vip = var.advertise_on_public_default_vip
service_policies_from_namespace = local.use_service_policies_from_namespace
active_service_policies {
dynamic "policies" {
for_each = var.active_service_policies
content {
name = policies.value.name
namespace = policies.value.namespace
tenant = policies.value.tenant
}
}
}
no_challenge = var.no_challenge
disable_rate_limit = var.disable_rate_limit
user_id_client_ip = var.user_id_client_ip
source_ip_stickiness = var.source_ip_stickiness
add_location = var.add_location
https {
port = var.https_config["https"].port
add_hsts = var.https_config["https"].add_hsts
http_redirect = var.https_config["https"].http_redirect
enable_path_normalize = var.https_config["https"].enable_path_normalize
connection_idle_timeout = var.https_config["https"].connection_idle_timeout
default_header = var.https_config["https"].default_header
default_loadbalancer = var.https_config["https"].default_loadbalancer
disable_path_normalize = var.https_config["https"].disable_path_normalize
}
dynamic "default_route_pools" {
for_each = var.default_route_pools
content {
pool {
name = default_route_pools.value.name
namespace = default_route_pools.value.namespace
tenant = default_route_pools.value.tenant
}
weight = default_route_pools.value.weight
}
}
dynamic "routes" {
for_each = var.simple_routes
content {
simple_route {
auto_host_rewrite = routes.value.auto_host_rewrite
disable_host_rewrite = routes.value.disable_host_rewrite
http_method = routes.value.http_method
}
app_firewall {
name = var.app_firewall.name
namespace = var.app_firewall.namespace
tenant = var.app_firewall.tenant
}
dynamic "more_option" {
for_each = var.more_option
content {
response_headers_to_add {
append = more_option.value.append
name = more_option.value.name
value = more_option.value.value
}
}
}
}
#############tfvars:
simple_routes = [
{
auto_host_rewrite = true
disable_host_rewrite = false
http_method = "ANY"
advanced_options = {
common_buffering = true
common_hash_policy = true
default_retry_policy = true
disable_location_add = false
disable_mirroring = true
disable_prefix_rewrite = true
disable_spdy = true
disable_waf = false
disable_web_socket_config = true
do_not_retract_cluster = false
enable_spdy = false
inherited_bot_defense_javascript_injection = true
inherited_waf = true
no_retry_policy = false
priority = "DEFAULT"
request_headers_to_remove = []
response_headers_to_remove = []
retract_cluster = true
timeout = 30000
response_headers_to_add = {
append = true
name = "response_via_simple_route"
value = "true"
}
}
incoming_port = {
no_port_match = true
port = 0
}
origin_pools = {
priority = 1
weight = 1
pool = {
name = "vslx-prod-maint-maint-test-tf"
}
}
path = {
prefix = "/"
}
}
]
#######module caller
module "loadbalancer" {
source = "../../modules/loadbalancer_simple"
namespace = var.namespace
environment = var.environment
tenant = var.tenant
#pass origin pool object to load balancer module
depends_on_origin_pool = [
volterra_origin_pool.op-maint-test,
volterra_origin_pool.op-maint-test2 ]
name_prefix = local.name_prefix
name_suffix = local.name_suffix
https_config = {
https = {
domains = var.domains_lb01
port = 443
add_hsts = true
http_redirect = true
enable_path_normalize = true
connection_idle_timeout = 0
default_header = false
default_loadbalancer = false
disable_path_normalize = false
non_default_loadbalancer = false
pass_through = false
tls_cert_params = {
no_mtls = true
tls_config = {
default_security = true
}
certificates = [
{
namespace = var.namespace
name = volterra_certificate.cert-maint-test.name
tenant = var.tenant
},
{
namespace = var.namespace
name = volterra_certificate.cert-maint-test2.name
tenant = var.tenant
}
]
}
}
}
default_route_pools = [
{
name = volterra_origin_pool.op-maint-test.name
namespace = var.namespace
tenant = var.tenant
weight = 1
}
]
custom_routes = [
# {
# name = volterra_route.route-maint-test2-com.name
# namespace = var.namespace
# tenant = var.tenant
# },
# {
# name = volterra_route.route-maint-test-com.name
# namespace = var.namespace
# tenant = var.tenant
# }
]
simple_routes = [
{
auto_host_rewrite = true
disable_host_rewrite = false
http_method = "ANY"
# (1 unchanged attribute hidden)
]
active_service_policies = [
{
name = "vslx-${var.environment}-f5xc-srvpoly-explicit-allow-tf"
namespace = var.namespace
tenant = var.tenant
},
{
name = "vslx-${var.environment}-f5xc-srvpoly-default-allow-all-tf"
namespace = var.namespace
tenant = var.tenant
}
]
app_firewall = {
name = volterra_app_firewall.firewall-maint-waap.name
namespace = var.namespace
tenant = var.tenant
}
more_option = [
{
append = true
name = "response_from_lb"
value = "true"
}
]
tags = {
Terraform = "true"
Environment = "${var.environment}"
}
}
The text was updated successfully, but these errors were encountered: