terraform-google-modules / terraform-google-lb-http

Creates a global HTTP load balancer for Compute Engine by using forwarding rules
https://registry.terraform.io/modules/terraform-google-modules/lb-http/google
Apache License 2.0
319 stars 365 forks source link

Can't set cache mode for serverless NEG to FORCE_CACHE_ALL #432

Closed douglasward closed 1 month ago

douglasward commented 5 months ago

TL;DR

Changing the cache mode for a serverless NEG backend from CACHE_ALL_STATIC to FORCE_CACHE_ALL fails with

Invalid value for field 'resource.cdnPolicy.maxTtl': '10800'. max_ttl must be specified with CACHE_ALL_STATIC cache_mode only.

Expected behavior

If maxTtl isn't set or it is set to null then it should be removed from the cdn policy settings and allow the change to succeed.

Observed behavior

the current maxTtl value isn't removed / default is sent

Terraform Configuration

module "lb-http" {
  source  = "GoogleCloudPlatform/lb-http/google//modules/serverless_negs"
  version = "~> 11.1.0"
  name    = "production-lb"
  project = "xxx"

  foo-bar = {
    description                     = null
    port_name                       = "http"
    protocol                        = "HTTP"
    session_affinity                = "NONE"
    timeout_sec                     = 30
    connection_draining_timeout_sec = 0
    load_balancing_scheme           = "EXTERNAL"
    enable_cdn                      = true
    cdn_policy = {
      cache_mode  = "FORCE_CACHE_ALL"
      default_ttl = 3600
      client_ttl  = 7200
      cache_key_policy = {
        include_host         = true
        include_protocol     = true
        include_query_string = true
      }
    }
  }
}

Terraform Version

Terraform v1.6.1
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v5.32.0
+ provider registry.terraform.io/hashicorp/google-beta v5.32.0
+ provider registry.terraform.io/hashicorp/random v3.6.2

Additional information

This issue appears to already have been addressed here https://github.com/hashicorp/terraform-provider-google/issues/16935 but it still isn't working for me

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

douglasward commented 3 months ago

can anyone help me with this?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days