Skip to content

Creating a load balancer for a storage bucket #198

@chubibest

Description

@chubibest

I want to spin up a load balancer with an ip for a storage bucket, but I run into this error whenever I run 'terraform apply'
Screenshot 2021-08-11 at 16 08 24
This is my config file

resource "google_compute_backend_bucket" "storage_bucket_backend" {
  name        = "storage-bucket-backend"
  description = "${var.project} storage bucket"
  bucket_name = google_storage_bucket.storage_bucket.name
  enable_cdn  = true
  project       = var.project
}

resource "google_storage_bucket" "storage_bucket" {
  name     = "storage-bucket"
}

resource "google_storage_bucket_access_control" "public_rule" {
  bucket = google_storage_bucket.storage_bucket.name
  role   = "READER"
  entity = "allUsers"
}

module "cdn-lb-http" {
  source            = "GoogleCloudPlatform/lb-http/google"
  version = "~> 4.4"
  project           = var.project
  name              = "storage-bucket-backend-load-balancer"
  backends = {
    default = {

      affinity_cookie_ttl_sec         = null
      connection_draining_timeout_sec = null
      custom_request_headers          = null
      custom_response_headers         = null
      description                     = null
      enable_cdn                      = true

            protocol                        = "HTTP"
      port                            = 80
      port_name                       = "http"
      timeout_sec                     = 10
      connection_draining_timeout_sec = null
      enable_cdn                      = false
      security_policy                 = null
      session_affinity                = null
        health_check = {
        check_interval_sec  = null
        timeout_sec         = null
        healthy_threshold   = null
        unhealthy_threshold = null
        request_path        = "/"
        port                = null
        host                = null
        logging             = null
      }
      log_config = {
        enable = true
        sample_rate = 1.0
      }

      groups = [
        {
          # Each node pool instance group should be added to the backend.
          group = google_compute_backend_bucket.storage_bucket_backend.id
          balancing_mode               = null
          capacity_scaler              = null
          description                  = null
          max_connections              = null
          max_connections_per_instance = null
          max_connections_per_endpoint = null
          max_rate                     = null
          max_rate_per_instance        = null
          max_rate_per_endpoint        = null
          max_utilization              = null
        },
      ]

      iap_config = {
        enable               = false
        oauth2_client_id     = null
        oauth2_client_secret = null
      }
    }
  }

  cdn = true
  create_address = true
  https_redirect = true
  managed_ssl_certificate_domains = tolist(["cdn.${var.domain}"])
  ssl = true
  use_ssl_certificates = false
}

output "ip" {
  value = module.cdn-lb-http.external_ip
}

Little help please.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2high priority issuesenhancementNew feature or requesttriagedScoped and ready for work

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions